RE: one long lived connection or many short lived?

2005-03-02 Thread David Brodbeck
 -Original Message-
 From: Tommy McNeely [mailto:[EMAIL PROTECTED]

 I am building an IRC based application bot (using libmysql) .. that 
 will take commands from users (!mybugs, !mybugs KEY !newbugs, 
 etc), do 
 SQL queries and of course dump formatted results back to the channel. 
 Currently its setup to open a single DB connection at initialization 
 and use that connection over and over... would it be better 
 or worse to 
 have it open/close a connection for each command in the way 
 a web app would?

There's a tradeoff here.

One connection is much more efficient.  If you're expecting frequent
commands this is definately a concern.  However, you'll need good error
handling, so your app can reconnect when that connection drops.  Granted,
you should have this *anyway*, but with the 'lots of little connections'
scheme you get a chance to start over every time a new command is issued.

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



one long lived connection or many short lived?

2005-02-17 Thread Tommy McNeely
Hi,
I apologize in advance, I am sure this question has been asked dozens 
of times, but my searches came up empty.

I am building an IRC based application bot (using libmysql) .. that 
will take commands from users (!mybugs, !mybugs KEY !newbugs, etc), do 
SQL queries and of course dump formatted results back to the channel. 
Currently its setup to open a single DB connection at initialization 
and use that connection over and over... would it be better or worse to 
have it open/close a connection for each command in the way a web app 
would?

Some things to keep in mind :)
- IRC server/services bot is half way across the US from the mySQL 
server (connection reliability?)
- queries will likely be spaced out by hours or days (idle disconnect?)
- when one person does a query, its almost assured that there will be 
10 more within 10 seconds :)

- I would *like* to do SSL (still studying how to do that), so that 
will most certainly increase the mysql_real_connect() time?

- Does the client library maintain a pool of connections or something 
like that?

Thanks in advance,
Tommy
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]