Search code examples
cperformancec89

possible to write webapplication using ANSI - C scripting?


I want to develop a web application using ANSI C. Since, I want have to have the application to be fast enough than others and also it should support the all kind of operations as the normal scripting php, python or any scripting language provides. Even if you have idea for fastest access with database rather than C, please recommend anything better

If anyone have idea please share the tutorials to start.


Solution

  • I'm not aware of any C web application frameworks, and so if you did wish to write your application in C you will need to handle all communication between your application / framework and the web server through a web server interface - the easiest starting point for understanding this is probably to read up on CGI, however once you understand how CGI works you will want to move onto understanding FastCGI instead, as although FastCGI is more complex, CGI is notoriously slow.

    However I strongly recommend that you don't bother unless you are attempting this for academic purposes!:

    • The path you are suggesting involves low level stuff - its interesting, but a lot of work to achieve things that can be done incredibly easily in any half-decent web application framework.

    • With web applications is that the thing that matters is throughput (number of requests you can handle in a given time period), not speed (the time it takes to process a single request) - it might seem that a web site written in C would be much faster, however in reality the execution speed of C counts for incredibly little vs (for example) Caching and other optimisations.

    • Other frameworks already exist that are proven and lightning fast!

    The end result is that anything that you come up with will almost certainly be more work and slower than using "slow" scripting languages.