Question

How do you think, is it a good idea to write own web-server for a high-loaded project with built-in native code comparing to nginx + C++ module? Probably, productivity gains will be negligible?

And what about the safety of this approach (С++ module for nginx) compare to usage of interpreted programming languages?

Was it helpful?

Solution

Don't do it.

Your time will be better spent investigating how you can improve the caching of your resources. Investigate HTTP's Cache-Control, conditional GET, Transfer-Encoding (ie gzip) & Range headers (in that order).

If you use ORM investigate wether you can enable persistence caching to eliminate network hops to your DB.

Also, investigate the use of a CDN and caching reverse proxy such as Varnish.

OTHER TIPS

Don't choose and take both (compiled C scripts). G-WAN let you mix C scripts and compiled libraries with a simple '#pragma link' directive so you can choose which part of your code will be pre-compiled and which part will stay in a script.

It will be quite difficult to write your own safe webserver. nginx is very extensively tested and fulfils the security aspect better. Speed is probably not a problem (nginx is lightning-fast). You can still use multiple nginx processes if the load gets to heavy.

Regarding programming language: If you are really dealing with a high-performance app, you are probably going to need a C++ module, but in most cases interpreted languages will suit the needs. I prefer interpreted languages, since development can be done much faster. If it gets too slow, you can still switch to C++.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top