BACK
dpfTVS and CGI

dpfTVS of course supports CGI/1.1, but if you run it in threading mode CGI speed swill suffer a great deal, especially under high load. That is not due to my inefficient coding, it works fine in forking mode. The base of CGI is that the main program does a fork/exec combination. That was the normal method a couple of years ago to start new processes. Now is fork originally a form to create (heavy weight) threads, so to ensure that a forked program can run as intended it creates a copy of the current process. In our days this got a huge performance boost by only making real copies of the parts that are changed at runtime, what is internally done by a command called clone. There are many problems with this technique to create a thread. For one the new process doesn't have anyway to communicate directly with the one it originated from. For those, things like pipelines and later shared memory were made. Today we use (light weight) threads, their creation is much faster. They share the same code and global objects but have their own set of working variables. It has of course its own problems, so it is not possible to start a program from a thread without forking first, or you overwrite the program as a whole. A multi-threaded server like dpfTVS uses a lot threads, these are integral part of the program, so a fork has to copy all this information too, even if it only takes its own running thread with it. This causes a threaded server to be slower when it actually does a fork for a change than a forking based one, slowing in our case the CGI part down.

What to do about it. Well, this was one of the reasons why dpfTVS had an external, via mugi connected, cgi-server for a long time. This one doesn't have the speed drop under load as it has its own forking core. So if you want for any reason to run dpfTVS in threading mode I advise you to use the mugi-cgiserver instead of the internal one. But I honestly think the forking mode is just fine for all purposes. The CGI-server is currently just a revamped version of the old one originally used by TVS 1.35, so it is far from being optimised and still slower than the internal one in fork mode. I'll change that with some priority in the coming days as this mugi CGI-sever has some other useful benefits.

BACK