Mohammed Rashad | 4 Jun 2012 04:13
Picon

Spawning another wthttpd instance

Hi,

Is it possible to spawn a new instance of wthttpd application when there are more number of users accessing it. for example the 0-5 users gets instance1 and 5-10 gets instance2 and so on. My application is not scaling up for cloud system. Is it because of builtin httpd server. I used monit and I found that it uses less cpu and ram but still application hangs and is becoming slow even with good internet connection. For example, a WDialog appears with some text and nothing in the background (CSS loading problems)

Is there anything which I can do to make my Wt httpd application to scale up to use more resources if needed ?

Can Wt httpd application make use of multiple cpus ?

--
Regards,
   Rashad

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
witty-interest mailing list
witty-interest@...
https://lists.sourceforge.net/lists/listinfo/witty-interest
Nagaev Boris | 4 Jun 2012 15:30
Picon
Gravatar

Re: Spawning another wthttpd instance

Hello!

You can spawn multiple instances of your application on several ports
(even on several machines). See example of doing so:
http://www.webtoolkit.eu/wt/blog/2010/11/24/haproxy___wt__a_good_good_match

However, even one wthttpd instance can scale up to multiple cpus (at
least to multiple cores), since it uses several threads (10 by
default). Because the locks are (nearly) not used in Wt applications,
these threads do not disturb each other. If you have >10 cores, just
increase threads number (option --threads of wthttpd).

CSS loading problems are likely to be a bug of wthttp.

PS. You'd better use front-end webserver (e.g., nginx) to host CSS and
other static files. wthttpd is not so good on hosting static files.

On Mon, Jun 4, 2012 at 6:13 AM, Mohammed Rashad
<mohammedrashadkm <at> gmail.com> wrote:
> Hi,
> Is it possible to spawn a new instance of wthttpd application when there are
> more number of users accessing it. for example the 0-5 users gets instance1
> and 5-10 gets instance2 and so on. My application is not scaling up for
> cloud system. Is it because of builtin httpd server. I used monit and I
> found that it uses less cpu and ram but still application hangs and is
> becoming slow even with good internet connection. For example, a WDialog
> appears with some text and nothing in the background (CSS loading problems)
>
> Is there anything which I can do to make my Wt httpd application to scale up
> to use more resources if needed ?
>
> Can Wt httpd application make use of multiple cpus ?
>
> --
> Regards,
>    Rashad
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> witty-interest mailing list
> witty-interest <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/witty-interest
>

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
witty-interest mailing list
witty-interest <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest
Mohammed Rashad | 4 Jun 2012 17:35
Picon

Re: Spawning another wthttpd instance

Thanks Wim and Nagev.


I will try out threads option. Also as Wim said i am using exec() which I will replace with show() and hide().

On Mon, Jun 4, 2012 at 7:00 PM, Nagaev Boris <bnagaev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
Hello!

You can spawn multiple instances of your application on several ports
(even on several machines). See example of doing so:
http://www.webtoolkit.eu/wt/blog/2010/11/24/haproxy___wt__a_good_good_match

However, even one wthttpd instance can scale up to multiple cpus (at
least to multiple cores), since it uses several threads (10 by
default). Because the locks are (nearly) not used in Wt applications,
these threads do not disturb each other. If you have >10 cores, just
increase threads number (option --threads of wthttpd).

CSS loading problems are likely to be a bug of wthttp.

PS. You'd better use front-end webserver (e.g., nginx) to host CSS and
other static files. wthttpd is not so good on hosting static files.

On Mon, Jun 4, 2012 at 6:13 AM, Mohammed Rashad
<mohammedrashadkm-Re5JQEeQqe8@public.gmane.orgm> wrote:
> Hi,
> Is it possible to spawn a new instance of wthttpd application when there are
> more number of users accessing it. for example the 0-5 users gets instance1
> and 5-10 gets instance2 and so on. My application is not scaling up for
> cloud system. Is it because of builtin httpd server. I used monit and I
> found that it uses less cpu and ram but still application hangs and is
> becoming slow even with good internet connection. For example, a WDialog
> appears with some text and nothing in the background (CSS loading problems)
>
> Is there anything which I can do to make my Wt httpd application to scale up
> to use more resources if needed ?
>
> Can Wt httpd application make use of multiple cpus ?
>
> --
> Regards,
>    Rashad
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> witty-interest mailing list
> witty-interest <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/witty-interest
>

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
witty-interest mailing list
witty-interest <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest



--
Regards,
   Rashad

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
witty-interest mailing list
witty-interest@...
https://lists.sourceforge.net/lists/listinfo/witty-interest
Wim Dumon | 4 Jun 2012 15:32
Picon
Favicon

Re: Spawning another wthttpd instance

Hello Mohammed,

Wt's wthttpd is multithreaded and asynchronous, which is capable of providing excellent performance. There are a few things you need to be aware:
- The amount of threads used by wthttpd can be set by the --thread startup option (by default this threadpool contains 10 threads).
- If this threadpool is exhausted, new incoming requests will not be answered until threads become available.
- Avoid to do long computations in wthttpd's threads. The UI of your session will show the loading indicator, and the thread cannot be used to serve other clients for the duration of the computation. To resolve the situation, increase the amount of threads used by wthttpd, or perform your computations in a sepatate thread/process
- Avoid the use of 'recursing event loops'. As you mention dialog: if you use exec() to display a dialog, the session will occupy a thread until the user closes the dialog and exec() returns. Instead, use show() and hide() to display/hide dialogs (see documentation of WDialog). Do not use exec() in applications that will have more users that the amount of threads in your wthttpd threadpool.

The OS will automatically schedule the active threads on multiple CPUs.

Best regards,
Wim.

2012/6/4 Mohammed Rashad <mohammedrashadkm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Hi,
Is it possible to spawn a new instance of wthttpd application when there are more number of users accessing it. for example the 0-5 users gets instance1 and 5-10 gets instance2 and so on. My application is not scaling up for cloud system. Is it because of builtin httpd server. I used monit and I found that it uses less cpu and ram but still application hangs and is becoming slow even with good internet connection. For example, a WDialog appears with some text and nothing in the background (CSS loading problems)

Is there anything which I can do to make my Wt httpd application to scale up to use more resources if needed ?

Can Wt httpd application make use of multiple cpus ?

--
Regards,
   Rashad


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
witty-interest mailing list
witty-interest <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
witty-interest mailing list
witty-interest@...
https://lists.sourceforge.net/lists/listinfo/witty-interest

Gmane