cppcms icon indicating copy to clipboard operation
cppcms copied to clipboard

applications_pool_size

Open parihaaraka opened this issue 7 years ago • 2 comments
trafficstars

Hello.

  1. Can't find applications_pool_size within sources any more. What is the way to manage sync applications pool size (and thread pool size)?
  2. In my typical case I process a request by async app and find out that long-running job is needed, so I want to pass the job (partially done) to different thread to continue processing. Now we have submit_to_asynchronous_application and submit_to_pool now. Whether the only way to link these two parts of code is to pass a key via url (to search for the job in some custom storage)? I suspect that thread_pool could be useful in job-centralized processing, but it's hard to get the way it works in conjunction with applications. As a result: custom queues and custom adjustable thread pools. Please, direct me how to use cppcms natively for such a task.

parihaaraka avatar Jan 15 '18 11:01 parihaaraka

Can't find applications_pool_size within sources any more

See: http://cppcms.com/wikipp/en/page/cppcms_1_2_pool_api

The synchronous applications number will not exceed the thread pool size. There was a design issue in CppCMS 1.0 that was fixed in 1.2

I suspect that thread_pool could be useful in job-centralized processing

Yes you can always submit a job to cppcms thread pool directly.

Whether the only way to link these two parts of code is to pass a key via url (to search for the job in some custom storage)

You can associate an arbitrary data to http::context when you pass it to another application/pool using Context specific data API: reset_specific, get_specific and release_specific member functions of the context:

http://cppcms.com/cppcms_ref/latest/classcppcms_1_1http_1_1context.html#a9ade01f327999cebf9f0f5a28fb7e9d8

artyom-beilis avatar Jan 17 '18 07:01 artyom-beilis

Why it would be useful to instantiate an asynchronous application on first access only? Usually it is a basis of some complex functionality being processed within it's event loop. I've switched to new initialization methods and had to use prepopulated flag to let it work as expected.

parihaaraka avatar Jan 18 '18 08:01 parihaaraka