Main  /  Edit  /  History  /   /  Users Area

New Applications Pool API in 1.2

CppCMS 1.1 introduced a new API for cppcms::applications_pool

Why New API

CppCMS 1.0 API had some design issues

Also new API was introduced and old one is considered deprecated it is fully supported and works well. So no need to run and change all your code meanwhile

Another issue that exists in CppCMS 1.0 is that applications pool can generate much more applications that actually are in use.

All synchronous applications are created in the event loop when the request is ready and then transferred to thread pool for execution. It can create a situation where we have 5 threads with applications doing some hard job and accepted 20 more connections and created applications for them just to wait in the thread pool queue for execution.

This issue was fixed for old API as well. There will be no more synchronous applications than the number of threads

New API

In the nutshell:

Mount policy

Basic API for mounting an application is

void mount(booster::shared_ptr<cppcms::application_specific_pool> pool,
           cppcms::mount_point const &point,
           int flags = 0);

Up to this it is quite similar to old API, what is different is flags option.

You can provide following flags that placed in namespace cppcms::app:

Mode Flags:

Options:

HTTP Context Transfer

Now it is also possible to "send" existing connection from one pool/application to another one. Allowing more dynamic relations between the applications.

cppcms::http::context has two new following member functions:

void submit_to_pool(booster::shared_ptr<application_specific_pool> pool,std::string const &url);
void submit_to_asynchronous_application(booster::intrusive_ptr<application> app,std::string const &url);

You can transfer a connection from for example filtering asynchronous application to synchronous one or/and send back some request to asynchronous handling as well.

About

CppCMS is a web development framework for performance demanding applications.

Support This Project

SourceForge.net Logo

Поддержать проект

CppCMS needs You


Navigation

Main Page


Valid CSS | Valid XHTML 1.0