(i.e. use a connection pool and recycle connections.)
50 ms doesn't seem all that long to me, particularly if it's a TCP connection; you didn't say what kind of connection it was, or how fast your network was, or how fast your hardware was, so hard to draw any conclusions.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
How to do connection pooling? Actually I am using MySQLDB fpr one of my python(cgi) based web application. Can you give some idea about building connections and pooling them? Is there any solution already available?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Consider the fact that PHP and perl (if you are using mod_perl) do not require a fork/exec to run your script, whereas running Python (or anything else) running as CGI does. If you're going to make comparisions like this, use mod_python or some other persistent scheme, like an HTTPServer-based system instead of Apache, or else test perl and PHP as pure CGI. You are not comparing connection setup times, you are comparing how long it takes to spawn a request within Apache vs. spawning another process, which takes a lot longer than connecting to MySQL.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I noticed that opening a connection takes about 0.04 to 0.05 seconds. Isn't that a bit much?
Then don't do it.
(i.e. use a connection pool and recycle connections.)
50 ms doesn't seem all that long to me, particularly if it's a TCP connection; you didn't say what kind of connection it was, or how fast your network was, or how fast your hardware was, so hard to draw any conclusions.
How to do connection pooling? Actually I am using MySQLDB fpr one of my python(cgi) based web application. Can you give some idea about building connections and pooling them? Is there any solution already available?
I was testing this on a cgi script on my own pc (1400Mhz). I'm pretty sure perl and php are much faster connecting to mysql
That's nice.
Consider the fact that PHP and perl (if you are using mod_perl) do not require a fork/exec to run your script, whereas running Python (or anything else) running as CGI does. If you're going to make comparisions like this, use mod_python or some other persistent scheme, like an HTTPServer-based system instead of Apache, or else test perl and PHP as pure CGI. You are not comparing connection setup times, you are comparing how long it takes to spawn a request within Apache vs. spawning another process, which takes a lot longer than connecting to MySQL.