Discussion:
[omniORB] Connections from C++ to MySQL
Leslie Chemwolo
2008-05-21 19:24:39 UTC
Permalink
Hi,
I have a C++ class that has a loop in which connections to mysql database are made and disconnected towards the end of a loop. I have realised that the number of loops I can make in one run reduces over time. It hits a certain number and the programs stops running. I start it immediately and the number of loops it makes this time decreases. It does so until it makes around 10 loops. Then it is like it somehow clears some connections then the next running makes around 80 loops. Then the number of loops made in subsequent runs starts decreasing again.
When the program stops and I pause longer then the next time the loops will be more than when I immediately start the program when it stops.
Which is the culprit here? Is it that mysql is not clearing obsolete connections fast enough? I am asking because my class is closing connections using mysql_close(handle) at the end of the loop. Is there a way of forcing mysql to clear a connection that I have closed from my program?
The following is a record of number of loops in consecutive?runs in the order they appear:
->72 59 47 33 25 17 72 52 44 36 20 10 3 1
->67 54 50 42 33 25
->73 62 47 30 30 18 10 4 14
->67 54 50 42 33 25
->75 58 43 38 31 19
->80 60 52 36 27 25 19 14 11
->78 37 25 18 13
Regards,
Leslie
Stefan Naewe
2008-05-21 19:33:10 UTC
Permalink
Post by Leslie Chemwolo
Hi,
I have a C++ class that has a loop in which connections to mysql database are made and disconnected towards the end of a loop. I have realised that the number of loops I can make in one run reduces over time. It hits a certain number and the programs stops running. I start it immediately and the number of loops it makes this time decreases. It does so until it makes around 10 loops. Then it is like it somehow clears some connections then the next running makes around 80 loops. Then the number of loops made in subsequent runs starts decreasing again.
When the program stops and I pause longer then the next time the loops will be more than when I immediately start the program when it stops.
Which is the culprit here? Is it that mysql is not clearing obsolete connections fast enough? I am asking because my class is closing connections using mysql_close(handle) at the end of the loop. Is there a way of forcing mysql to clear a connection that I have closed from my program?
->72 59 47 33 25 17 72 52 44 36 20 10 3 1
->67 54 50 42 33 25
->73 62 47 30 30 18 10 4 14
->67 54 50 42 33 25
->75 58 43 38 31 19
->80 60 52 36 27 25 19 14 11
->78 37 25 18 13
Regards,
Leslie
And your omniORB question is ?


S.
--
----------------------------------------------------------------
Dipl.-Inform. Stefan Naewe ATLAS Elektronik GmbH
Dept.: NUS T4
phone: +49-(0)421-457-1378 Sebaldsbruecker Heerstr. 235
fax: +49-(0)421-457-3913 28305 Bremen
----------------------------------------------------------------
/dev/random says: Falls don't kill people. It's the deceleration trauma.
Loading...