Hey Aaron,

That sounds like a trick, but I wouldn't mind having a proper setting
'dispatcher-thread-pool' that's used only in dedicated process mode. If you
still care for it, can you file a feature request?

Regards,
koen

2016-09-18 7:15 GMT+02:00 Aarón Bueno Villares <abv15...@gmail.com>:

> I finally did the following trick (only valid in dedicated process mode,
> of course):
>
> The wthttpd connector, when throwing a new process session, it launchs a
> new instance of the program with the option --parent-port=X at the end, and
> X being the port of the main server (as set in --http-port). The server
> knows if it is the main process or a child process checking if parent-port
> is set or not.
>
>      Wt::WServer server(argc, argv, WTHTTP_CONFIGURATION);
>
>      std::string arg(argv[argc - 1]);
>      auto* test = "--parent-port";
>
>      // If != 0, and thus, the option is not present (as last parameter).
>      if (arg.compare(0, strlen(test), test)) {
>           std::string thread_count;
>           server.readConfigurationProperty("thread-count", thread_count);
> // I added it as <property> in my wt_config.xml
>           server.ioService().setThreadCount(std::stoi(thread_count));
>      }
>
> After launching the server and a tab with the page loaded, I checked, with
> pstree -a, how many threads I have in both the main and child processes,
> and effectively, only the thread pool of the main process changed.
>
> Before that trick, I tried to check if it is a parent or child process
> with WServer::httpPort(), to see to which port is the server binded to, but
> before running start(), the tcp endpoint of the parent process is not yet
> set and it crashes (gdb output):
>
> Program received signal SIGSEGV, Segmentation fault.
> http::server::Server::httpPort (this=0x0) at /usr/include/boost/asio/
> socket_acceptor_service.hpp:249
> 249  endpoint_type local_endpoint(const implementation_type& impl,
> (gdb) back
> #0  http::server::Server::httpPort (this=0x0) at /usr/include/boost/asio/
> socket_acceptor_service.hpp:249
> #1  0x0000000000484e55 in main (argc=11, argv=0x7fffffffe3d8) at
> main.cpp:25
>
>
>
>
> 2016-09-16 12:09 GMT+02:00 Marco Kinski <wagner.ma...@gmail.com>:
>
>> Hi Aarón,
>>
>> > [snip]
>> > For example, if I'm afraid about make my app multithreading, I could
>> set the
>> > thread-count = 0, but that makes the main server's thread-pool 0 as
>> well,
>> > lowering the server responsiveness.
>>
>> inside wcoonfig.h is a build option to enable/disable mt-support
>> (#cmakedefine WT_THREADED).
>> I never tried it, but it sounds like what your looking for.
>>
>> regards, Marco
>>
>> ------------------------------------------------------------
>> ------------------
>> _______________________________________________
>> witty-interest mailing list
>> witty-interest@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/witty-interest
>>
>
>
> ------------------------------------------------------------
> ------------------
>
> _______________________________________________
> witty-interest mailing list
> witty-interest@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/witty-interest
>
>
------------------------------------------------------------------------------
_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to