in reply to Re^7: appending to html at beginning (don't use CGI.pm)
in thread appending to html at beginning
If you mean speed-wise, you may be right
I do and I am. :-)
About a year ago a new project was starting and it was unclear at that point whether it would be better as a traditional CGI system or using some sort of persistent back-end. Having read of the joys of Plack this sounded to me like an ideal use for it - code the system with Plack and we could switch seamlessly between normal CGI and a persistent application.
Obviously the first thing to do was to put together a prototype to prove the concept. I wrote a little "hello world" script using Plack (it may even have been lifted directly from the docs) and managed to get it running without much bother as a persistent job. Then I switched over the front end and had it running as traditional CGI. That's when I noticed the speed issue.
We all expect a CGI script to be slower than a persistent system (that's why there's an F in FCGI after all) but this was noticeably slower. And it seemed to me to be a lot slower than many of the other CGI scripts I would normally use. And it wasn't even doing anything other than respond with "Hello World".
So I did the natural thing and benchmarked it as a traditional CGI both with Plack and without. It turned out that using Plack slowed down the traditional CGI by about a factor of 6.
It was decided that this was just too much of a penalty so instead of using Plack I wrote a frontend which had a very simple loading routine that could be called either from CGI or from an FCGI implementation. This added no measurable difference to the execution time of the plain CGIs and meant that we could easily switch between the two approaches as the need arose.
TL;DR: Plack is a nice idea but while it technically can be used for traditional CGI scripts beware that the penalty is a big slowdown.
|
---|