A customer of ours is asking us to implement a module in C in Apache webserver for performance reasons. This module should handle Peaceful uri's, access a database and return leads to json format. Lots of people here have suggested python mod_wsgi rather - however for simplicity of programming reasons. Can anybody let me know if there's a substantial difference in performance between your mod_wsgi python solution versus. the Apache + C.module. Any anecdotes? Pointers with a study published online?
This module should handle Peaceful uri's, access a database and return leads to json format.
That seems like the majority of the job is I/O bound so you won't get a performance boost by utilizing C.
This is actually the strategy I would suggest.
- Implement in Python
- After setting it up done, profile the code to ascertain if you will find any CPU bottlenecks.
- Implement only the bottleneck portions in C.
G-WAN ANSI C scripts have proven that C scripts make an enormous amount of difference when it comes to speed, see:
So using C is probably not an awful idea in the end...
If you would like the very best of both mobile phone industry's: maintainable code and speed, use Cython (http://cython.org). Cython compiles Python code (with optional type information) to C or C++, which is put together to system code.