Re: [Wt-interest] "ThreadPool in parent and child processes (dedicated mode)"
Done, but, I've created it twice by mistake (due to the format ¬¬ and the no possibility of edition... and the hope a request made by me could be erased). 2016-09-29 13:21 GMT+02:00 Koen Deforche : > Hey Aaron, > > You can do that at http://redmine.emweb.be/projects/wt/issues > > Regards, > koen > > 2016-09-28 22:32 GMT+02:00 Aarón Bueno Villares : > >> And how can I do that? >> >> 2016-09-28 21:12 GMT+02:00 Koen Deforche : >> >>> 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 : >>> 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 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 0x00484e55 in main (argc=11, argv=0x7fffe3d8) at main.cpp:25 2016-09-16 12:09 GMT+02:00 Marco Kinski : > 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 >>> >>> >> >> >> -- >> >> ___ >> 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
Re: [Wt-interest] "ThreadPool in parent and child processes (dedicated mode)"
Hey Aaron, You can do that at http://redmine.emweb.be/projects/wt/issues Regards, koen 2016-09-28 22:32 GMT+02:00 Aarón Bueno Villares : > And how can I do that? > > 2016-09-28 21:12 GMT+02:00 Koen Deforche : > >> 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 : >> >>> 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 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 0x00484e55 in main (argc=11, argv=0x7fffe3d8) at >>> main.cpp:25 >>> >>> >>> >>> >>> 2016-09-16 12:09 GMT+02:00 Marco Kinski : >>> 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 >> >> > > > -- > > ___ > 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
Re: [Wt-interest] "ThreadPool in parent and child processes (dedicated mode)"
And how can I do that? 2016-09-28 21:12 GMT+02:00 Koen Deforche : > 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 : > >> 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 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 0x00484e55 in main (argc=11, argv=0x7fffe3d8) at >> main.cpp:25 >> >> >> >> >> 2016-09-16 12:09 GMT+02:00 Marco Kinski : >> >>> 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 > > -- ___ witty-interest mailing list witty-interest@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/witty-interest
Re: [Wt-interest] "ThreadPool in parent and child processes (dedicated mode)"
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 : > 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 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 0x00484e55 in main (argc=11, argv=0x7fffe3d8) at > main.cpp:25 > > > > > 2016-09-16 12:09 GMT+02:00 Marco Kinski : > >> 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
Re: [Wt-interest] "ThreadPool in parent and child processes (dedicated mode)"
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 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 0x00484e55 in main (argc=11, argv=0x7fffe3d8) at main.cpp:25 2016-09-16 12:09 GMT+02:00 Marco Kinski : > 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
Re: [Wt-interest] "ThreadPool in parent and child processes (dedicated mode)"
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