Re: [Cppcms-users] DB connection pooling
Brought to you by:
artyom-beilis
|
From: Shiv S. D. <shi...@gm...> - 2012-10-22 13:48:02
|
Agreed. So where do I put my DB connection pool? As mentioned in
documentation "The CppCMS service has a simple design of a single event
loop and a thread pool that handles actual user application responses."
this means on outer side there is an event-based design and internally
there is a thread pool. Therefore I draw a conclusion that I need a thread
based pool and once the application is mounted and a factory object is
created right where I hit first db query I should use one connection from
pool.
On Mon, Oct 22, 2012 at 6:30 PM, Lee Elenbaas <lee...@gm...>wrote:
> I fail to see the connection between the application being asynchronious
> and the DB connections being pooled
>
> if you need to do several things with the same DB at the same time (or
> simply in different threads)
> you need several DB connections - you can choose to pool them - and this
> way reuse them
>
> both synchronious and asynchronious applications can handle multiple
> threads - so both need some way of using db connections - and a pool is one
> good way to do that
>
> On Mon, Oct 22, 2012 at 2:22 PM, Shiv Shankar Dayal <
> shi...@gm...> wrote:
>
>> Hi,
>>
>> Consider the following piece of documentation
>>
>> If the application that handles it is a synchronous application, its
>> execution is passed to the *thread pool*. The user application prepares
>> the response and sends it synchronously to the client and the context is
>> destroyed, completing the "requst/response" cycle.
>>
>> If the application is asynchronous, the HTTP Context remains inside the
>> event loop's thread and it is handled by the asynchronous application. This
>> application may decide to complete the response immediately or postpone it
>> by implementing, for example, long polling.
>> and following code
>>
>> 1. int main(int argc,char ** argv)
>> 2. {
>> 3. try {
>> 4. cppcms::service srv(argc,argv);
>> 5. srv.applications_pool().mount(
>> 6. cppcms::applications_factory<hello>()
>> 7. );
>>
>> now as it is also written that applications are asynchronous what is the
>> need of more that one database connection. Is it the case that one
>> persistent connection will suffice?
>> --
>> Best regards,
>> Shiv Shankar Dayal
>>
>>
>> ------------------------------------------------------------------------------
>> Everyone hates slow websites. So do we.
>> Make your web apps faster with AppDynamics
>> Download AppDynamics Lite for free today:
>> http://p.sf.net/sfu/appdyn_sfd2d_oct
>> _______________________________________________
>> Cppcms-users mailing list
>> Cpp...@li...
>> https://lists.sourceforge.net/lists/listinfo/cppcms-users
>>
>>
>
>
> --
> --
> lee
> Lee Elenbaas
> lee...@gm...
>
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_sfd2d_oct
> _______________________________________________
> Cppcms-users mailing list
> Cpp...@li...
> https://lists.sourceforge.net/lists/listinfo/cppcms-users
>
>
--
Best regards,
Shiv Shankar Dayal
|