简体   繁体   English

可以使用 ANSI - C 脚本编写 Web 应用程序吗?

[英]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.我想使用 ANSI C 开发一个 Web 应用程序。因为,我希望该应用程序必须比其他应用程序足够快,而且它应该支持正常脚本 php、python 或任何脚本语言提供的所有类型的操作。 Even if you have idea for fastest access with database rather than C, please recommend anything better即使您有使用数据库而不是 C 进行最快访问的想法,也请推荐更好的方法

If anyone have idea please share the tutorials to start.如果有人有想法,请分享教程以开始。

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.我不知道任何 C Web 应用程序框架,因此如果您确实希望用 C 编写应用程序,则需要通过 Web 服务器接口处理应用程序/框架与 Web 服务器之间的所有通信——最简单的起点要理解这可能需要阅读CGI ,但是一旦你理解了 CGI 的工作原理,你就会想转而理解FastCGI ,因为尽管 FastCGI 更复杂,但 CGI 是出了名的慢。

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.您建议的路径涉及低级的东西——它很有趣,但是要实现在任何半正经的 Web 应用程序框架中都可以非常容易地完成的事情,需要做很多工作。

  • 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.对于 Web 应用程序来说,重要的是吞吐量(在给定时间段内您可以处理的请求数),而不是速度(处理单个请求所需的时间)——看起来用 C 编写的网站会快得多,但实际上 C 的执行速度与(例如)缓存和其他优化相比非常小。

  • 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.有很多 Web 框架,您可以在其中生成运行非常高效的代码。 Even 'scripted' web frameworks often cache the scripts and reduce much of the initial slowdown involved in parsing and executing.即使是“脚本化”的 Web 框架也经常缓存脚本并减少解析和执行中涉及的大部分初始减速。

And frameworks that use compiled bytecode/IL can be quite fast once loaded/JIT'ed.使用编译字节码/IL 的框架在加载/JIT 后可以非常快。


If you plan to write your own HTTP engine in C, though;不过,如果您打算用 C 编写自己的 HTTP 引擎; 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 .我听说过很多关于FastCGI的好消息。 Maybe you should try that?也许你应该试试看?

You should checkout g-wan by trustleap.你应该通过 trustleap 检查 g-wan。 It allows you to write servlets in ansi-c, taking care of all the nitty gritty regarding the http protocol.它允许您在 ansi-c 中编写 servlet,处理有关 http 协议的所有细节。

http://www.trustleap.com/ http://www.trustleap.com/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM