The System (Oracle+weblogic) released in the previous period frequently hangs, every morning 9 points, 2 o'clock in the afternoon peak on the hanging, tangled for a long time, the final Solution, method description under.
Executes select COUNT (*), status from V$session Group by status, instruction, discovers the number of inactive connections is large, when rising to a certain number of sum, hanging.
The following optimizations have been made, including database optimization and WebLogic optimization.
1. Database optimization
1) Create Pfile sql>create pfile from SPFile
Check
- Oracle/product/10.1.0/admin/orcl/pfile/init.ora.xxxxxxxx ' (Exact path:/oracle/admin/oradb/pfile/init.ora.352012231626 The file exists and is backed up locally.
2) Stop Web services, backing up the database, backing up the published code
3) view parameters and record
1. Show parameter SGA
2. View Pga_aggregate_target Value
SELECT NAME, value/1024/1024 MB
From V$pgastat
WHERE NAME in (' Aggregate PGA target parameter ', ' Global Memory Bound ');
4) Modify the contents of a pfile
--alter system set sga_max_size=4096m scope=spfile;
--alter system set sga_target= 4096M scope=spfile;
--alter system set pga_aggregate_target=2048m scope=spfile;
Alter system set PRE_PAGE_SGA=TRUE Scope=spfile;
Alter system set LOCK_SGA=TRUE Scope=spfile;
Alter system set Workarea_size_policy=auto Scope=spfile;
5) Modify limits.conf Restart your computer
/etc/security/limits.conf Add the following line to this configuration file (Oracle is the operating system account that initiates the database), meaning that Oracle users can lock any large amount of space in physical memory:
Oracle-memlock Unlimited
Then restart the operating system reboot
6) If starting the database fails, perform a repair
Startup pfile= ' .../product/10.1.0/admin/orcl/pfile/init.ora.xxxxxxxx '
7) Modify the Oracle connection pool and restart the database
The relationship between Oracle's sessions and processes is
Sessions=1.1*processes + 5
Sql>show parameter processes;
Sql>alter system set processes=1000 scope = SPFile;
Sql>show parameter session;
Sql>alter system set sessions=1105 scope = SPFile;
2, optimize WebLogic
1) Modify the Web server connection pool
WebLogic Server has 26G of memory, to meet 1000 concurrent traffic, you can set the data source connection pool up to 2000.
Initial capacity changed to 500 current setting value 3
Maximum capacity changed to 2000 current setting value 200
Capacity growth changed to 100 current setting value 3
Restart WebLogic
2) Modify the Web server JVM memory size (parameters to be determined)
Locate the Weblogic\common\bin\commenv.cmd file in the installation directory
Open Modify the following code:
Sun
If "%production_mode%" = = "true" goto Sun_prod_mode
Set Java_vm=-client
Set MEM_ARGS=-XMS1024MM-XMX2048mm-xx:maxpermsize=256m
Set java_options=%java_options%-xverify:none goto Continue:sun_prod_mode Set Java_vm=-server ...
3) Release the new program
4) Restart the Web server operating system
3. Final Solution
After the above treatment, the system has been significantly optimized, but the crash 3 times a day, 8 in the morning, 10 points, about 3 o'clock in the afternoon.
After performing the following 2 instructions to view the activity and stack information of the thread, you can track which method causes the system stack delay.
Top-h This command is to see which line is more busy
Jstack-l 8032 | Less this command is to view the stack information, which can be seen in the stack delay as a result of the execution of the method. No delay can not see, there is a delay to see which method caused the system congestion, and later found that there is a method of code efficiency is very low, and the most frequent access, peak access time coincides with the time of the crash.
After the optimization method, the system is stable.