开发者

Why is CGIHTTPServer so slow in Windows?

开发者 https://www.devze.com 2023-03-06 22:53 出处:网络
A few days ago, I noticed that serving requests from Python 2.7\'s and 2.6\'s CGIHTTPServer running on localhost have a small but noticeable (~2 second) delay when running on Windows, this lag does no

A few days ago, I noticed that serving requests from Python 2.7's and 2.6's CGIHTTPServer running on localhost have a small but noticeable (~2 second) delay when running on Windows, this lag does not exist on Linux running on the same hardware (the page I'm writing is AJAX heavy and this lag is slowing down testing). I've tried this on a few oth开发者_JAVA百科er computer and tried a dead simple test CGI script (print random.randint(...)) with similar results.

I've sometimes heard people saying that Window's CreateProcess is much slower than Linux's fork-exec but I always dismissed them as 100-years-old arguments that is no longer relevant in modern Windows in modern hardware. Now I'm seeing this with my own eye.

However, I'm going to put on my skeptical spectacle. Anyone had any alternative explanation to explain why CGIHTTPServer is so much slower on Windows compared to on Linux?


I think cgihttpserver spawns a process for each request, this is a lot slower on windows, you may have more luck by using a threaded solution instead (wsgi?)

0

精彩评论

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