durusmail: durus-users: Pylons/Durus tutorial
Pylons/Durus tutorial
2006-12-13
2006-12-13
2006-12-13
2006-12-13
Pylons/Durus tutorial
David Binger
2006-12-13
On Dec 12, 2006, at 7:11 PM, Mike Orr wrote:

> Hi all.  I wrote a tutorial on using Pylons with Durus, specifically
> on modifying the QuickWiki tutorial to use Durus instead of
> SQLAlchemy.

That's a cool thing to do.

> One remaining issue is where to put the database connection.  Right
> now I create it in the controller's .__begin__() method, but that
> recreates it (and the client socket) for every request.  I may be able
> to put it in Pylons' 'g' object if it's truly a thread-local global,
> which I'm verifying.  Otherwise I may make a connection pool and stick
> it somewhere.  Does the overhead in opening a connection to a Durus
> server matter that much?

It matters if you care about performance.
When you don't reuse a connection, you are
working without any cached objects.  Even if your OS IO buffers
hold everything in the file, you are, at a minimum, decompressing
and unpickling every object that you need to prepare the response.

I hope the "g" object solution you suggest works.
That sounds like a reasonable approach.
If not, you can make your own thread-local global
for this purpose.

> I'm using TCP sockets rather than Unix
> domain sockets because I couldn't get the latter to work.

I'd be interested to know the details, to see if we could
get it working for you.

reply