开发者

Why FastCGI is so slow?

开发者 https://www.devze.com 2023-04-03 21:20 出处:网络
Recently I\'ve compared two versions of my C++ application that processes huge files (tens of GBs): a regular executable and fastcgi binary spawned under the lighttpd server. It turned out that fastcg

Recently I've compared two versions of my C++ application that processes huge files (tens of GBs): a regular executable and fastcgi binary spawned under the lighttpd server. It turned out that fastcgi version was nearly 5 times slower. The program basically reads lots of lines from the files on the disc through FILE descriptors, fcgi version does exaclty the same. So where did the slowdown come from?

Thanks for the comments! My program does the following:

Initialization: - reads several files opened by fopen() line-by-line using fgets (a file contains several millions of lines) - builds some data structure in the RAM during files processing - outputs small log messages to a file on the disk after each file is processed

Dialog: - the rest of time answers search queries via stdin/stdout

And the FCGI version: FCGX_Init()

Intialization (just as it was in the original version)

while (FCGX_Accept()) { Dialog (th开发者_如何学Gorough fcgi socket instead of stdin/stdout) }

And I am talking only about initialization part performance. I hope there is enough information now.

0

精彩评论

暂无评论...
验证码 换一张
取 消