Re: [Cppcms-users] Can Cppcms fully work asynchronously?
Brought to you by:
artyom-beilis
From: Artyom B. <art...@ya...> - 2015-04-24 09:10:21
|
> > 1. Can cppcms run multiple threads asynchronously? > I know it can handle asynchronous requests by event loop but can it be run with > thread pool and run several requests simultaneously? Or the thread pool is only > for synchronous jobs.> > I don't really understand your question. CppCMS thread pool has multiple threads to execute any kind of "jobs". You post a job to the thread pool and it would be picked up by an available thread or would be queued for execution. > > >2. Can Cppdb handle asynchronous query? > > I mean that providing callback at query execution and be > called later when query is finished. Maybe this must be > handled with cppcms event loop.> Is there any example using asynchronous query or it's not possible? > No, CppDB can't run asynchronous queries, because there almost no SQL API available that allows to run stuff asynchronously. Sqlite3, MySQL and ODBC do not provide such an option. So if you want to run some "blocking" stuff you can submit a job to a thread pool and post a completion handler back to the event loop. > >3. What is the difference between running cppcms as multi process mode beside > running only single process mode? > > I found that on windows platform it can't be run as multi process mode. > I'm not going to run it on windows for production but is there any other big > difference I have to aware? Something like local cache is shared between > threads but not shared between processes. Or some performance effect like > running 8 processes with single thread mode, or running 1 process with 8 > threads. Information about Internal structure about performance would be helpful.> > First of all even if you run in prefork (multi-process) mode you still have a thread pool per process. Additionally, each process has its own event loop. In multi-process mode you have several - one per process. In future version of CppCMS it is planned to run several event loops per CppCMS process. About sharing. CppCMS supports process shared cache, session and other stuff. However on the application level you should be aware of it. You run multiple instances of the same process so you should be aware of it, for example using some sort of IPC or shared resources. To be honest. I found prefork (multi-process) mode much less useful that I thought it would be. > > >4. Dynamic loading .so files >I saw that cppcms highly recommend to use dynamic loading > views but I also found that auto update (checking .so > file's modification date and auto reloading views) > function may affect bad performance. So, dynamic loading > views are only good with test mode and static library > loading is better for production service? > > I'm only asking at the aspect of performance. Loading all > .so files at startup looks much better for performance. I'm > about to load more than 100 .so view files. You have an _option_ to dynamically reload so if it changes in the run-time. It is useful for development (so you don't have to restart application for a small HTML fix), not more than that. However using shared objects gives more more flexibility. It does not impose performance penalties, unless you turn the "auto-reload" option on explicitly. Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ |