[Cppcms-users] Q&A: async gzip and mount
Brought to you by:
artyom-beilis
|
From: Markus R. <us...@ma...> - 2013-03-09 16:50:14
|
Hi users! Here are some questions (with answers) which could be of interest: 1.) Is it possible to use gzip compression on async connections? Artyom Beilis wrote: > No you can't, for two reasons: > > 1. You can't really do streaming with gzip compression > as the stream becomes buffered. > 2. The compression process costs a lot so it not wise > to use it in the single event-loop's thread. 2.) What is the difference between booster::intrusive_ptr<App> c=new App(service); service.applications_pool().mount(c); and: service.applications_pool().mount(cppcms::applications_factory<App>()); Artyom Beilis wrote: > in the first case you have a single application > instance that only being executed in a single thread > of the event loop, in the second case multiple applications > are created on demand and run in the thread pool. See: http://cppcms.com/cppcms_ref/1.0.2/classcppcms_1_1applications__pool.html 3.) Are there some examples how to mount multiple applications (both sync and async; with dispatcher and using main; mounting the same application twice) using mount_points? Now there is: cppcms::service app(argc,argv); app.applications_pool().mount(cppcms::applications_factory<myapp>(), cppcms::mount_point("/myapp(/(.*))?", 1)); app.applications_pool().mount(cppcms::applications_factory<numbers>(), cppcms::mount_point("/numbers(/(.*))?", 1)); app.applications_pool().mount(cppcms::applications_factory<letters>(), cppcms::mount_point("/letters(/(.*))?", 1)); booster::intrusive_ptr<async> c (new async(app)); app.applications_pool().mount(c, cppcms::mount_point("/async(/(.*))?", 1)); app.applications_pool().mount(cppcms::applications_factory<sync>(), cppcms::mount_point("/sync(/(.*))?", 1)); app.run(); See attached file for full example, there are small issues with double mounting in the example: the URL mapper does not always work correctly. See also http://cppcms.com/cppcms_ref/1.0.2/classcppcms_1_1mount__point.html Best regards Markus |