Re: [Cppcms-users] CppCMS as Comet Server
Brought to you by:
artyom-beilis
From: Artyom B. <art...@ya...> - 2013-01-02 07:53:04
|
>________________________________ > From: william lee <we...@gm...> >To: Artyom Beilis <art...@ya...>; cpp...@li... >Sent: Wednesday, January 2, 2013 9:38 AM >Subject: Re: [Cppcms-users] CppCMS as Comet Server > > >Hi. >I'm happy to share the current status of my Comet Server effort. > > > With Artyom's helping answer on client side issues, I start to pour > in connection for cppcms based comet server, long polling type. > > > On Amazon EC2, I'm using M1 Extra Large Instance Type, with 15G Mem, 4 Core(8EC2 CU), > I successfully got 500K concurrent connections, I'm quite happy with this half million result. Nice :-) > At this payload, the system is still very good responsive, > only memory usage is little high, at 12.xG used, left about > 2.xG free. CPU usage is quite low, and related to real business logic. > > This is something I'm working on these days, reducing memory consumption and improving general performance of asynchronous processes. > > > Right now, I'm using 10 cppcms based processes, and listen > on different ports. > I shall take a look at how to use same port number next, > the prefolk method mentioned previously by Artyom. > > What you can do is to define service.worker_processes option http://cppcms.com/wikipp/en/page/cppcms_1x_config#service.worker_processes Note, that when service::run is executed the application would fork off processes. You may give a handler to "cppcms::service::after_fork()" that would be executed after fork to do some process specific stuff. Be careful with sharing resources many resources would likely to be opened, like DB connections, IPC after forking. > > >Cheers, >William L. > Regards, Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ > > >On Sat, Dec 29, 2012 at 1:50 AM, Artyom Beilis <art...@ya...> wrote: > > >>>________________________________ >>> From: william lee <we...@gm...> >>>To: Artyom Beilis <art...@ya...>; cpp...@li... >>>Sent: Friday, December 28, 2012 3:07 AM >>>Subject: Re: [Cppcms-users] CppCMS as Comet Server >> >>> >>> >>>wow. you do benchmark on a laptop? :) >> >> >>Yep >> >> >>>Thanks for the detailed reply, and here is another reference I read about: >>> >>> >>>http://webcache.googleusercontent.com/search?q=cache:2iV4meP2vIMJ:blog.urbanairship.com/blog/2010/09/29/linux-kernel-tuning-for-c500k/+&cd=1&hl=en&ct=clnk&gl=us >>> >>> >>> >>>It mentioned C65K Myth. >>> >> >>Yes, you are right I've got little bit confused, >>however it is still hard to benchmark more then 20K concurrent requests >>as you need many clients on different ip addresses. >> >> >>> >>>Actually I expect more connection than that. >>>The more connection I can have per server, the less cost it will be. >>> >> >>So plan it as scalable application and use multiple processes. prefork would work >>better with many concurrent connections. >> >>In any case I don't see specific restrictions given enough memory and configures OS. >> >> >>> >> >>>I will try and see how it comes :) >>> >> >>Tell us how did it worked out :-) >> >> >> >> >>Artyom Beilis >>-------------- >>CppCMS - C++ Web Framework: http://cppcms.com/ >>CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >> >>> >>>thanks, >>>William L. >>> >>> >>> >>>On Fri, Dec 28, 2012 at 5:54 AM, Artyom Beilis <art...@ya...> wrote: >>> >>>Actually it is very good questions... >>>> >>>> >>>>What is the performance, I did some benchmarks but had not full time to publish them... >>>> >>>> >>>>In general I could easily handle 20,000 connections and send updates (SSE) using vanila CppCMS code >>>>and broadcast around 50,000 messages per second (i.e. each connection 2.5 msg/s) >>>> >>>> >>>>Having 200-500 connections I could send about 100,000 messages per second. >>>> >>>> >>>>This was done using the most stright forward implementation using event-stream API I had written about it in the blog. >>>> >>>> >>>>Now to handle more than 20,000 K connections you need more network interfaces (ips) (as TCP/IP can't handle theoretically more than 65K connections in single IP address) which i couldn't check. >>>> >>>> >>>>Now when you deal with Comet everything is handled in currently single event loop one thread. So to scale up today the >>>>easiest is to use prefork mode (more then 1 worker process see service.worker_processes) >>>>thus you would have several event loops and you can scale them >>>>over multiple CPUs. It would be slower for low loads for much better for high onces. >>>> >>>> >>>>For example using 20,000 connections I could send 120,000 msgs/s i.e. 6/msg per connection which was quite liner scale up over CPUs on this particular machine. >>>> >>>> >>>>However using prefork with comet would require IPC so you would need to notify somehow each process on event, but it is must to >>>>have to scale over multiple CPUs and especially over multiple hosts. >>>> >>>> >>>>Also in general such benchmarking requires: >>>> >>>> >>>>- Tuning TCP/IP stack, make big backlog - very important and setting appropriate backlog option in application, also make sure you have wide port range, etc. >>>>- Ensure you have high ulimits to handle many descriptors >>>> >>>> >>>>Also I should note that I expect to do some optimization in CppCMS 1.2 to increase these numbers after some extensive profiling I did >>>>(there is lots of space for improvement) >>>> >>>> >>>>All these numbers I got running on Laptop with i5 2.4 GHz 2 cores 4 threads 4GB RAM (of wich I used quite a few) >>>> >>>> >>>> >>>> >>>>Regards >>>> >>>> >>>> >>>>Artyom Beilis >>>>-------------- >>>>CppCMS - C++ Web Framework: http://cppcms.com/ >>>>CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >>>> >>>> >>>> >>>>>________________________________ >>>>> From: william lee <we...@gm...> >>>>>To: cpp...@li... >>>>>Sent: Thursday, December 27, 2012 4:22 PM >>>>>Subject: [Cppcms-users] CppCMS as Comet Server >>>>> >>>>> >>>>> >>>>>Hi, >>>>>I'm thinking of using CppCMS to implement a Comet Server for Pushing short messages to connected users via Http. >>>>> >>>>> >>>>>Do you have any ideas from performance perspective, how much connections CppCMS application can handle at the same time per server? >>>>> >>>>> >>>>>The server spec is like 10G RAM, 8Core CPU etc, and http traffic is not heavy, I'm thinking about keep a connection for 10 mins then release it and let it reconnect back. >>>>> >>>>> >>>>>If anyone have some benchmark result, that will be great! >>>>> >>>>> >>>>>Thanks and appreciated >>>>> >>>>> >>>>>Happy New Year >>>>>William L. >>>>>------------------------------------------------------------------------------ >>>>>Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, >>>>>MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current >>>>>with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft >>>>>MVPs and experts. ON SALE this month only -- learn more at: >>>>>http://p.sf.net/sfu/learnmore_122712 >>>>>_______________________________________________ >>>>>Cppcms-users mailing list >>>>>Cpp...@li... >>>>>https://lists.sourceforge.net/lists/listinfo/cppcms-users >>>>> >>>>> >>>>> >>>>------------------------------------------------------------------------------ >>>>Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, >>>>MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current >>>>with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft >>>>MVPs and experts. ON SALE this month only -- learn more at: >>>>http://p.sf.net/sfu/learnmore_122712 >>>>_______________________________________________ >>>>Cppcms-users mailing list >>>>Cpp...@li... >>>>https://lists.sourceforge.net/lists/listinfo/cppcms-users >>>> >>>> >>> >>>------------------------------------------------------------------------------ >>>Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and >>>much more. Get web development skills now with LearnDevNow - >>>350+ hours of step-by-step video tutorials by Microsoft MVPs and experts. >>>SALE $99.99 this month only -- learn more at: >>>http://p.sf.net/sfu/learnmore_122812 >> >>>_______________________________________________ >>>Cppcms-users mailing list >>>Cpp...@li... >>>https://lists.sourceforge.net/lists/listinfo/cppcms-users >>> >>> >>> >> >>------------------------------------------------------------------------------ >>Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and >>much more. Get web development skills now with LearnDevNow - >>350+ hours of step-by-step video tutorials by Microsoft MVPs and experts. >>SALE $99.99 this month only -- learn more at: >>http://p.sf.net/sfu/learnmore_122812 >> >>_______________________________________________ >>Cppcms-users mailing list >>Cpp...@li... >>https://lists.sourceforge.net/lists/listinfo/cppcms-users >> > >------------------------------------------------------------------------------ >Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery >and much more. Keep your Java skills current with LearnJavaNow - >200+ hours of step-by-step video tutorials by Java experts. >SALE $49.99 this month only -- learn more at: >http://p.sf.net/sfu/learnmore_122612 >_______________________________________________ >Cppcms-users mailing list >Cpp...@li... >https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > |