Recently need a simple webserver, a few do the following simple comparison:
The selection principle is as follows: Support CGI: Need to use Cgilua to occupy less CPU resources and best support cross-platform
1:kepler/xavante
Advantages: Cross-platform, support Windows,linux and other mainstream operating systems. Because it is written in Lua itself, the framework supports LUA very well.
Disadvantage: Each request is a new LUA virtual machine, if the same file more than one request, you will see if the previously cached virtual machine is valid, if it is valid still use the virtual machine.
Although there is a recycling mechanism (I also changed the code to force recycling), but the memory does not see a noticeable drop, so memory usage will be more and more until you have all the files are accessed.
2:shttpd
Advantages: Cross-platform, support Windows,linux and other mainstream operating systems. Less code (only 3 k lines) internal support Perl,python, expected next version support LUA
Disadvantages: After the installation of Linux operation, directly startled me, with a 10M of memory, no need to look carefully, just throw it away
3:thttpd
Advantages: Less code, less memory footprint
Disadvantage: can only run on the class Linux operating system as long as a similar http://ip/cgi-bin/cgi/xxxx call, are directly to the CGI processing of all files are read at once, while caching. System calls that are not highly privileged, such as invoking the following command, will not succeed (changed code, logged in as root, unsuccessful)
Os.execute ("reboot")
Would have been most inclined to use Kepler/xavante, but the memory is not recycled, had to discard, and shttpd in the trial when the direct abandonment, then have to use THTTPD, look at the code, the process of the CGI changed, the file cache, temporarily do not deal with cache , static pages are generally not large), but consider other ways to system calls.
The result of the last modification is that the total amount of memory consumed is less than 1 m unless the file is uploaded.
Because the Web page is written with Cgilua, so in Windows directly with Xavante do webserver, embedded Linux under the switch to THTTPD