用于嵌入式服务器的 Web 技术
我最近开始了一个针对嵌入式设备的新 Web 开发项目,并希望征求一些有关使用技术的建议。该设备将提供 HTML 页面,其中包括用于从 JSON 服务器检索数据的 AJAX 代码。我们暂时使用 Cherokee 作为 Web 服务器,但我们并不依赖它。
目前,我正在考虑以下技术:
全部用 PHP 编写。我知道它很大、很慢、很臃肿,但我有大约 10MB 的可用空间用于 Web 界面(对于嵌入式系统来说很多),而且我们不会在任何这些设备上看到大量流量。然而,它确实需要对用户具有响应能力(页面加载时间应在不到一秒的时间内)。
FastCGI + C 程序 - 我们使用内存数据库,因此 C 程序可以直接通过 API 与数据库交互。这将比 PHP 具有更好的性能,但开发时间和可靠性是一个问题,因为 C 不太适合 Web 开发。
Lua + Kepler - 这似乎是性能和开发时间之间的一个很好的中间立场。然而,我从未使用过 Lua,所以我不太确定如何在嵌入式 Web 项目中实现它。我也不确定它与 Cherokee Web 服务器的集成程度如何。
那么对上述技术有什么看法或过去的经验吗?还有其他我应该包括在列表中的吗?
谢谢, 亚历克斯
I've recently started a new web development project for an embedded device and wanted to solicit some recommendations for technologies to use. The device will serve HTML pages which include AJAX code to retrieve data from a JSON server. We're tentatively using Cherokee as the web server, though we're not tied to it.
Currently, I'm considering the following technologies:
Write it all in PHP. I know it's big, slow, and bloated, but I've got about 10MB available for the web interface (a lot for an embedded system), and we won't be seeing a lot of traffic on any of these devices. It does need to seem responsive for the users, however (pages should load in less than a second).
FastCGI + a C program - We're using an in-memory database, so the C program could interact with the database directly through the API. This would have much better performance than PHP, but development time and reliability is a concern since C isn't very well-suited for web development.
Lua + Kepler - This seems like a nice middle ground between performance and development time. However, I've never worked with Lua, so I'm not really sure how to implement it in an embedded web project. I'm also uncertain as to how well it integrates with the Cherokee web server.
So any opinions or past experiences with the above stated technologies? Any others I should include in the list?
Thanks,
Alex
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
当我在这个领域时,我使用了 Lua 和一个简单的 FastCGI 运行程序(Luaetta [因为我确信如果你问那个人就会得到最新的来源],尽管我也确信这不是唯一的,而且还有开普勒当然),由 lighttpd 产生。
它在嵌入式媒体播放器上表现良好,可用于远程访问内容和控制设备。虽然我不再维护它,但您可以在 http://matthewwild.co.uk 找到更多信息/projects/wooble 。如果您认为源代码会帮助我找到它,它目前只能通过包管理器获得,但鉴于动机,我可以解决这个问题。
该领域的另一个(又是 Lua)项目是 LuCI。这些人致力于为嵌入式设备(特别是路由器)制作 Web 界面,并制作了一个很好的框架,其中包含许多针对此类系统的支持库。
我不会担心不懂 Lua。如果你懂任何语言,那么你可以在一两天内学会 Lua,手册记录了整个语言,而且很短。
When I was in this area, I used Lua and a simple FastCGI runner (Luaetta [for I'm sure the latest source would be available if you asked the guy] , though I'm also sure that's not the only one, and there's Kepler of course), spawned by lighttpd.
It performed quite well on an embedded media player, and was used for remotely accessing content and controlling the device. Though I don't maintain it anymore, you can find more about it at http://matthewwild.co.uk/projects/wooble . If you think the source would help just poke me for it, it's currently only available via a package manager but I can fix that given the motivation.
Another (again Lua) project in this area is LuCI. These guys are dedicated to making a web interface for embedded devices (routers specifically), and have produced a nice framework with lots of supporting libraries geared towards that kind of system.
I wouldn't be concerned with not knowing Lua. If you know any language then you can pick up Lua in a day or two, the manual documents the whole language and is quite short.
看看 Facebook 的 PHP 编译器 HipHop 怎么样?
https://github.com/facebook/hiphop-php/wiki
这样你可以用 PHP 编写代码并有效地将其编译为 C++。
How about looking at HipHop, Facebook's PHP compiler?
https://github.com/facebook/hiphop-php/wiki
That way you can write your code in PHP and effectively compile it to C++.
ASP.NET。假设您对嵌入式 Windows Server 2008 不感兴趣,您仍然可以通过将 Mono 合并到 Cherokee 来利用 ASP.NET。您可以利用 Visual Studio 作为 RAD 开发环境,并使用 ASP.NET MVC 2< /a>.许多第三方用户控件也可以与 Mono 一起“正常工作”(Telerik 宣布支持 Mono 上的 ASP.NET 控件!)。
ASP.NET. Assuming that you wouldn't be interested in Embedded Windows Server 2008, you could still leverage ASP.NET by incorporating Mono into Cherokee. You could leverage Visual Studio as your RAD development environment and use things like ASP.NET MVC 2. A lot of third party user controls will also 'just work' with Mono (Telerik Announces Support for their ASP.NET controls on Mono!).