fphttpserver with concurrent connections lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- Graeme · 2014-08-08 06:57 Hi, I've only used the fphttpserver component for a single user embedded web server application. For a different part of the product I'm working on, I'm trying to reduce the installation effort by dropping the Apache Web Server install and complex configuration. The embedded fphttpserver worked so well in the embedded product, I'm wondering if it could work on a slightly bigger scale on a LAN. Is fphttpserver up to the task to handle 30-60 concurrent connections? The product runs in a classroom style environment where learners will log in and use the system for a hour at a time. The web server will mainly server Adobe Flash content. I'm in the process of writing a test project where I can hopefully start 30+ HTTP clients and hit the fphttpserver web server for a set duration to see how it copes. If somebody has already tested this, I would be very grateful to hear about your experiences. Regards,   Graeme ---------------------------------------------------------------------- hinst · 2014-08-08 08:43 fphttpserver has two modes, sync and async, in sync mode it uses only one thread and it won't process next request until it finished with the previous one, so no concurrent connnections in async mode fphttpserver creates a new thread for each request. Alternatively, you could derive some base class (don't remember exactly which one) and create a hybrid web server component which would use thread pool and keep some number of threads always running, that would reduce cpu usage.... In your case, however, the solution would be really simple: find where fp-http-web-server creates thread in code and set stack size. Why? Because by default stack size for new threads if rather large, like either 4 or 16 megabytes, so 60*4 would be 240 megabytes of RAM; but in my experience 128 kilobytes of stack is enough for pretty much everything where you don't have much recursion;;; so 60*128k = 7.5 megabytes of RAM only So yes, I think using unmodified fphttpserver to handle 60 concurrent connections should work just fine if you reduce stask size, otherwise you will be wasting lots of RAM ---------------------------------------------------------------------- Graeme · 2014-08-08 20:45 Thanks for information, I'll use it going forward. ---------------------------------------------------------------------- Leledumbo · 2014-08-09 03:37 Quote from: Graeme Geldenhuys on August 08, 2014, 10:45:33 pmThanks for information, I'll use it going forward. Please post your result later, I'd like to see some numbers, especially since it doesn't support keep-alive yet ---------------------------------------------------------------------- aradeonas · 2015-08-15 07:27 Quote from: Leledumbo on August 09, 2014, 05:37:45 amQuote from: Graeme Geldenhuys on August 08, 2014, 10:45:33 pmThanks for information, I'll use it going forward. Please post your result later, I'd like to see some numbers, especially since it doesn't support keep-alive yet Me too.In the end what you used for this situation?