[Cppcms-users] Mounting both synchronous and asynchronous applications
Brought to you by:
artyom-beilis
From: CN <cn...@gr...> - 2011-02-01 04:26:35
|
Hello, Imagine my site has both synchronous (for user login) and asynchronous (for interactive activities) pages. Is it a correct and good practice to mount both synchronous and asynchronous applications like the following code? //code begin class login:public cppcms::application{ .... } class interaction:public cppcms::application{ .... } int main() { cppcms::service s(argc,argv); s.applications_pool().mount(cppcms::applications_factory<login>()); booster::intrusive_ptr<interaction> i=new interaction(s); s.applications_pool().mount(i); s.run(); } //code end Please also correct me if my following thoughts are wrong: - When a request arrives, cppcms::service.run() loops all mounted applications and pass that request to every mounted application. It is the responsibility of every application to filter the interested passed in request by applying dispatcher().assign(). - This program can fire multiple instances of "login" class. Every login instance runs as a separate thread. Thus this program can concurrently process multiple incoming synchronous (login) requests. - This program process asynchronous requests only one at a time because only one instance of class "interaction" is created. As such, asynchronous applications are most likely the bottleneck of performance when the load is heavier. Thank you in advance! CN |