hibernate mysql autocommit

http://forum.springsource.org/showthread.php?12639-MySQL-set-autocommit-0-set-autocommit-1

以下设置避免每次事务都向db发送无用的commit请求

<bean id="dataSourceTarget">
  <property name="driverClassName"><value>com.mysql.jdbc.Driver</value></property>
  <property name="url"><value>jdbc&#58;mysql&#58;//localhost&#58;3306/imagedb</value></property>
  <property name="username"><value>admin</value></property>
  <property name="password"><value></value></property>
</bean>

<bean id="dataSource">
  <property name="targetDataSource"><ref local="dataSource"/></property>
</bean>

设置之前:

__ Questions ___________________________________________________________
Total           1.88M     5.3/s
Com_          1.32M     3.7/s  %Total:  69.98
DMS         512.62k     1.5/s           27.28
QC Hits      51.53k     0.1/s            2.74
COM_QUIT         36     0.0/s            0.00
-Unknown          7     0.0/s            0.00
Slow 2 s            2     0.0/s            0.00  %DMS:   0.00  Log:  ON
DMS           512.62k     1.5/s           27.28
SELECT      373.42k     1.1/s           19.87         72.85
INSERT       68.29k     0.2/s            3.63         13.32
UPDATE       61.07k     0.2/s            3.25         11.91
DELETE        9.84k     0.0/s            0.52          1.92
REPLACE           0       0/s            0.00          0.00
Com_            1.32M     3.7/s           69.98
set_option  875.44k     2.5/s           46.59
commit      436.17k     1.2/s           23.21
change_db       544     0.0/s            0.03

 

设置之后:

__ Questions ___________________________________________________________
Total          50.41M   197.8/s
DMS          32.99M   129.5/s  %Total:  65.45
Com_         16.53M    64.9/s           32.78
QC Hits     855.49k     3.4/s            1.70
COM_QUIT     34.27k     0.1/s            0.07
-Unknown         29     0.0/s            0.00
Slow 2 s            1     0.0/s            0.00  %DMS:   0.00  Log:  ON
DMS            32.99M   129.5/s           65.45
SELECT       17.61M    69.1/s           34.94         53.38
UPDATE       11.46M    45.0/s           22.74         34.74
INSERT        3.38M    13.3/s            6.70         10.24
DELETE      544.37k     2.1/s            1.08          1.65
REPLACE           0       0/s            0.00          0.00
Com_           16.53M    64.9/s           32.78
set_option   10.99M    43.1/s           21.81
commit        5.43M    21.3/s           10.76
change_db    34.37k     0.1/s            0.07
可以看到在设置之后

DMS语句从比例27%提升至65%.性能提升非常大.

 

发表评论?

4 条评论。

  1. hibernate mysql autocommit(二) | 天涯岛 - pingback on 2012 年 06 月 29 日 在 上午 3:54
  2. How many are there in a book? http://www.zoji.com/1230657 blogs lolita pics pics the girl is hot, its hilarious to see her guy all pissed off, but the cameraman is so fucking irritating!!! geez i couldnt even enjoy her groaning cuz his nuisance of a voice kept coming on!

  3. Lost credit card loli young hentai pics BEST VID EVER. truly made my dick explode.

发表评论


注意 - 你可以用以下 HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Trackbacks and Pingbacks: