[storm] Pooling ?

Andrew Holman andy at belator.com
Sun Nov 18 16:19:13 GMT 2007


That is actually my code that I was working with the guys in #storm  
and #cherrypy on.  I wound up getting this working. I also added a  
wiki entry to the tools section on the cherrypy.org website.  The code  
has been expanded and so far is working great. A big thanks go out to  
Niemeyer, Radix, fumanchu_ (cherrypy), dowski and the gang in #cherrypy.

This code is for the beta version of Cherrypy 3.1 so things would be  
different in 3.0.


- Andy


On Nov 17, 2007, at 9:44 PM, Håvard Gulldahl wrote:

> Hello, Andy, list,
>
> On 11/7/07, Andrew Holman <andy at belator.com> wrote:
>> I am working with CherryPy and am trying to figure out the best way
>> to incorporate Storm into it. Does Storm have any connection pooling?
>
> I'm currently in the same situation, and I freely admit that I find
> thread programming conceptually nauseating. However, I just came over
> this little pastie:
>
> http://pastie.caboo.se/pastes/117963 (author unknown)
>
> and it seems to do the right thing: attach a new store to each newly
> created thread.
>
> def connect_db(thread_index):
> 	database = create_database(cherrypy.config.get('storm.default.url'))
> 	cherrypy.thread_data.store = Store(database)
> 	
> cherrypy.engine.subscribe('start_thread', connect_db)
>
>
>> If not then what is the best way to handle ensuring the connections
>> are still alive with each thread?  I would assume we would have to
>> write something that would do a check/auto-connect if the threads
>> connection was no longer alive. How should that be handled?
>
>
> Now this doesn't handle disconnects, but it may serve as a useful
> starting point. What do you think?
>
> Håvard
>
>
>
> -- 
> Håvard Gulldahl <havard at gulldahl.no>



=================================
Andrew Holman
E-Mail: andy at belator.com
Skype: belator-andy




More information about the storm mailing list