[OSM-dev] [PATCH] Persistant database connection

SteveC steve at asklater.com
Sun Jul 9 21:16:51 BST 2006

* @ 09/07/06 08:20:00 PM james at mastros.biz wrote:
> Currently, the core of OSM is a bit silly: Every time it wants to execute
> some SQL, it connects to the database, runs the sql, gets the entire result
> set, and then disconnects from the database.  There's a number of ways in
> which that's silly, but the simplest one is that there's no reason to keep
> connecting and disconnecting -- connect when you first need the connection,
> and disconnect when you're all done.
> The attached patch touches only a very small amount of code, and will do
> just that.  There's still plenty of sillyness about, but this will at least
> pick this piece of low-hanging fruit.

Sharing one connection, I bet, will be slower than multiple connections.
If you spend some time using the API you will find that most calls take
many many times what the tcp set-up cost is.

A thread pool would be much better, and something on my todo list. There
is some example code on the net I was going to integrate... if anyone
else were to integrate that, it'd be cool

have fun,

SteveC steve at asklater.com http://www.asklater.com/steve/

More information about the dev mailing list