Thread: [Cppcms-users] DB connection pooling
Brought to you by:
artyom-beilis
From: Shiv S. D. <shi...@gm...> - 2012-10-22 12:22:31
|
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 |
From: Lee E. <lee...@gm...> - 2012-10-22 13:00:44
|
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... |
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 |
From: Lee E. <lee...@gm...> - 2012-10-23 16:29:47
|
I have not used cppDB yet - aside from some testing - but if you look at its API, it comes with a pool class, just hold an instance of that pool in your app, and use it whenever you need a connection you can pass a shared_ptr around for it - or just store it in a single place. but this is not part of the cppcms framework itself, and i have no idea how the pool will handle multiple threads requesting a connection at the same time - perhaps Artyom could answer that On Mon, Oct 22, 2012 at 3:47 PM, Shiv Shankar Dayal < shi...@gm...> wrote: > 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 > > > ------------------------------------------------------------------------------ > 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... |
From: Artyom B. <art...@ya...> - 2012-10-23 16:49:21
|
Using cppdb you only need to add a small parameter to connection string to enable connection pooling. It would automatically use a pool withing a special singleton. Usually you don't need to use the pool class directly. Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >________________________________ > From: Lee Elenbaas <lee...@gm...> >To: cpp...@li... >Sent: Tuesday, October 23, 2012 5:33 PM >Subject: Re: [Cppcms-users] DB connection pooling > > >I have not used cppDB yet - aside from some testing - but if you look at its API, it comes with a pool class, > > >just hold an instance of that pool in your app, and use it whenever you need a connection >you can pass a shared_ptr around for it - or just store it in a single place. > > >but this is not part of the cppcms framework itself, and i have no idea how the pool will handle multiple threads requesting a connection at the same time - perhaps Artyom could answer that > > >On Mon, Oct 22, 2012 at 3:47 PM, Shiv Shankar Dayal <shi...@gm...> wrote: > >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 >> >>------------------------------------------------------------------------------ >>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 > > > |
From: Shiv S. D. <shi...@gm...> - 2012-10-23 18:14:44
|
Hi, Is it simple to do write a backend driver based on what is available for Hypertable? On Tue, Oct 23, 2012 at 10:19 PM, Artyom Beilis <art...@ya...> wrote: > Using cppdb you only need to add a small parameter to connection string > to enable connection pooling. > It would automatically use a pool withing a special singleton. > > Usually you don't need to use the pool class directly. > > Artyom Beilis > -------------- > CppCMS - C++ Web Framework: http://cppcms.com/ > CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ > > ------------------------------ > *From:* Lee Elenbaas <lee...@gm...> > *To:* cpp...@li... > *Sent:* Tuesday, October 23, 2012 5:33 PM > *Subject:* Re: [Cppcms-users] DB connection pooling > > I have not used cppDB yet - aside from some testing - but if you look at > its API, it comes with a pool class, > > just hold an instance of that pool in your app, and use it whenever you > need a connection > you can pass a shared_ptr around for it - or just store it in a single > place. > > but this is not part of the cppcms framework itself, and i have no idea > how the pool will handle multiple threads requesting a connection at the > same time - perhaps Artyom could answer that > > On Mon, Oct 22, 2012 at 3:47 PM, Shiv Shankar Dayal < > shi...@gm...> wrote: > > 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 > > > ------------------------------------------------------------------------------ > 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 > > > > > ------------------------------------------------------------------------------ > 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 |
From: Artyom B. <art...@ya...> - 2012-10-24 14:48:26
|
I'm not familiar with the API of Hypertable but I assume it is not SQL :-) In any case implementing CppCMS backends is not hard as long as you familiar with specific library API. Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >________________________________ > From: Shiv Shankar Dayal <shi...@gm...> >To: Artyom Beilis <art...@ya...>; cpp...@li... >Sent: Tuesday, October 23, 2012 8:14 PM >Subject: Re: [Cppcms-users] DB connection pooling > > >Hi, > >Is it simple to do write a backend driver based on what is available for Hypertable? > > >On Tue, Oct 23, 2012 at 10:19 PM, Artyom Beilis <art...@ya...> wrote: > >Using cppdb you only need to add a small parameter to connection string to enable connection pooling. >>It would automatically use a pool withing a special singleton. >> >> >>Usually you don't need to use the pool class directly. >> >> >>Artyom Beilis >>-------------- >>CppCMS - C++ Web Framework: http://cppcms.com/ >>CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >> >> >> >>>________________________________ >>> From: Lee Elenbaas <lee...@gm...> >>>To: cpp...@li... >>>Sent: Tuesday, October 23, 2012 5:33 PM >>>Subject: Re: [Cppcms-users] DB connection pooling >>> >>> >>> >>>I have not used cppDB yet - aside from some testing - but if you look at its API, it comes with a pool class, >>> >>> >>>just hold an instance of that pool in your app, and use it whenever you need a connection >>>you can pass a shared_ptr around for it - or just store it in a single place. >>> >>> >>>but this is not part of the cppcms framework itself, and i have no idea how the pool will handle multiple threads requesting a connection at the same time - perhaps Artyom could answer that >>> >>> >>>On Mon, Oct 22, 2012 at 3:47 PM, Shiv Shankar Dayal <shi...@gm...> wrote: >>> >>>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 >>>> >>>>------------------------------------------------------------------------------ >>>>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 >>> >>> >>> >>------------------------------------------------------------------------------ >>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 > >------------------------------------------------------------------------------ >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 > > > |
From: Shiv S. D. <shi...@gm...> - 2012-10-24 15:55:49
|
No it is not SQL. It seems I will have to modify backend.h and write my own driver. :-) On Wed, Oct 24, 2012 at 7:48 AM, Artyom Beilis <art...@ya...> wrote: > I'm not familiar with the API of Hypertable but I assume it is not SQL :-) > > In any case implementing CppCMS backends is not hard as long as you > familiar with specific > library API. > > Artyom Beilis > -------------- > CppCMS - C++ Web Framework: http://cppcms.com/ > CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ > > ------------------------------ > *From:* Shiv Shankar Dayal <shi...@gm...> > *To:* Artyom Beilis <art...@ya...>; > cpp...@li... > *Sent:* Tuesday, October 23, 2012 8:14 PM > > *Subject:* Re: [Cppcms-users] DB connection pooling > > Hi, > > Is it simple to do write a backend driver based on what is available for > Hypertable? > > On Tue, Oct 23, 2012 at 10:19 PM, Artyom Beilis <art...@ya...>wrote: > > Using cppdb you only need to add a small parameter to connection string > to enable connection pooling. > It would automatically use a pool withing a special singleton. > > Usually you don't need to use the pool class directly. > > Artyom Beilis > -------------- > CppCMS - C++ Web Framework: http://cppcms.com/ > CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ > > ------------------------------ > *From:* Lee Elenbaas <lee...@gm...> > *To:* cpp...@li... > *Sent:* Tuesday, October 23, 2012 5:33 PM > *Subject:* Re: [Cppcms-users] DB connection pooling > > I have not used cppDB yet - aside from some testing - but if you look at > its API, it comes with a pool class, > > just hold an instance of that pool in your app, and use it whenever you > need a connection > you can pass a shared_ptr around for it - or just store it in a single > place. > > but this is not part of the cppcms framework itself, and i have no idea > how the pool will handle multiple threads requesting a connection at the > same time - perhaps Artyom could answer that > > On Mon, Oct 22, 2012 at 3:47 PM, Shiv Shankar Dayal < > shi...@gm...> wrote: > > 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 > > > ------------------------------------------------------------------------------ > 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 > > > > > ------------------------------------------------------------------------------ > 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 > > > ------------------------------------------------------------------------------ > 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 > > > > > ------------------------------------------------------------------------------ > 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 |
From: Shiv S. D. <shi...@gm...> - 2012-10-31 09:15:32
|
Hi Artyom, I have written a db pool which creates given no. of persistent connections and also dynamically increases connections. Say I create the pool globally and in the code where dispatcher calls functions which perform actual business logic I acquire one connection. Is it guaranteed that connections will execute in multi-threaded fashion. I have taken care in my db pool that it is thread-safe. On Wed, Oct 24, 2012 at 9:25 PM, Shiv Shankar Dayal < shi...@gm...> wrote: > No it is not SQL. It seems I will have to modify backend.h and write my > own driver. :-) > > > On Wed, Oct 24, 2012 at 7:48 AM, Artyom Beilis <art...@ya...>wrote: > >> I'm not familiar with the API of Hypertable but I assume it is not SQL :-) >> >> In any case implementing CppCMS backends is not hard as long as you >> familiar with specific >> library API. >> >> Artyom Beilis >> -------------- >> CppCMS - C++ Web Framework: http://cppcms.com/ >> CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >> >> ------------------------------ >> *From:* Shiv Shankar Dayal <shi...@gm...> >> *To:* Artyom Beilis <art...@ya...>; >> cpp...@li... >> *Sent:* Tuesday, October 23, 2012 8:14 PM >> >> *Subject:* Re: [Cppcms-users] DB connection pooling >> >> Hi, >> >> Is it simple to do write a backend driver based on what is available for >> Hypertable? >> >> On Tue, Oct 23, 2012 at 10:19 PM, Artyom Beilis <art...@ya...>wrote: >> >> Using cppdb you only need to add a small parameter to connection string >> to enable connection pooling. >> It would automatically use a pool withing a special singleton. >> >> Usually you don't need to use the pool class directly. >> >> Artyom Beilis >> -------------- >> CppCMS - C++ Web Framework: http://cppcms.com/ >> CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >> >> ------------------------------ >> *From:* Lee Elenbaas <lee...@gm...> >> *To:* cpp...@li... >> *Sent:* Tuesday, October 23, 2012 5:33 PM >> *Subject:* Re: [Cppcms-users] DB connection pooling >> >> I have not used cppDB yet - aside from some testing - but if you look at >> its API, it comes with a pool class, >> >> just hold an instance of that pool in your app, and use it whenever you >> need a connection >> you can pass a shared_ptr around for it - or just store it in a single >> place. >> >> but this is not part of the cppcms framework itself, and i have no idea >> how the pool will handle multiple threads requesting a connection at the >> same time - perhaps Artyom could answer that >> >> On Mon, Oct 22, 2012 at 3:47 PM, Shiv Shankar Dayal < >> shi...@gm...> wrote: >> >> 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 >> >> >> ------------------------------------------------------------------------------ >> 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 >> >> >> >> >> ------------------------------------------------------------------------------ >> 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 >> >> >> ------------------------------------------------------------------------------ >> 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 >> >> >> >> >> ------------------------------------------------------------------------------ >> 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 > -- Best regards, Shiv Shankar Dayal |