سؤال

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.

Thanks :)

هل كانت مفيدة؟

المحلول

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.

نصائح أخرى

Any kind of 'scripting' won't give you the 'raw speed' it seems you might be looking for.

I would generally strongly discourage this whole train of thought, though. There are plenty of web frameworks out there where you produce code that runs very efficiently. Even 'scripted' web frameworks often cache the scripts and reduce much of the initial slowdown involved in parsing and executing.

And frameworks that use compiled bytecode/IL can be quite fast once loaded/JIT'ed.


If you plan to write your own HTTP engine in C, though; I doubt you would be able to get something remotely close to as fast as anything else out there until you were very familiar with what's already out there; how they all work, all the variations in the protocols involved, etc, etc...

I've heard a lot of good things about FastCGI. Maybe you should try that?

You should checkout g-wan by trustleap. It allows you to write servlets in ansi-c, taking care of all the nitty gritty regarding the http protocol.

http://www.trustleap.com/

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top