Making a post request with CppCMS
We are using CppCMS server and its performance is very low for mail requests when message messages reach a certain size of some kB. This is already happening with the minimal primer server examples slightly modified:
#include <cppcms/application.h>
#include <cppcms/applications_pool.h>
#include <cppcms/service.h>
#include <cppcms/http_request.h>
#include <cppcms/http_response.h>
#include <cppcms/mount_point.h>
#include <booster/intrusive_ptr.h>
#include <utility>
#include <iostream>
#include <boost/timer.hpp>
class hello
: public cppcms::application
{
public:
hello(cppcms::service &srv) :
cppcms::application(srv), counter(0) {}
virtual void main(std::string url);
boost::timer my_timer;
int counter;
};
void hello::main(std::string url)
{
response().out() << "Hello from asynchron CppCMS after " << my_timer.elapsed() << "s\n";
std::cout << "[" << url.size() << "] = " << url.substr(0, 50) << '\n';
}
int main(int argc,char ** argv)
{
try {
cppcms::service srv(argc,argv);
booster::intrusive_ptr<hello> p= new hello(srv);
srv.applications_pool().mount( p, cppcms::mount_point("(.*)") );
srv.run();
}
catch(std::exception const &e) {
std::cerr << e.what() << std::endl;
}
return 0;
}
It's weird that the server only spends a few milliseconds on the main function, but one or two seconds between two calls.
- What is CppCMS doing during this time?
- And more importantly, how can this time be shortened?
- Is this a thread pool problem?
- Is there something expensive about messages? (I read something about compression) Can it be turned off or accelerated?
9 mail requests with XML files between 8 and 10kB take 9 seconds without even processing the requests. The same requests take less than half a second with a node.js server. I've tried different configurations and read a lot of dox and posts that couldn't find anything that explains these long downtime. Any help is appreciated.
Thanks in advance, Peter
source to share
No one has answered this question yet
Check out similar questions: