开发者

What technology shall I use for a webpage that constantly requests data from server

We need to create a web-based frontend for displaying some data. The problem is that the data needs to be updated about once a second. For me as a web-developer the obvious solution is AJAX. Unfortunately, one of the purposes of this web frontend is to be displayed inside of embedded browser window which is expected to run constantly for months or even years. That's it, months of work with no restart / refresh. During testing we ran a proof of concept interface (which requested a simple set of data each 1,5s) in Safari for over a month. During this period of time, the memory usage of Safari raised from ~30 MB to over 100MB. Thus we're afraid of stability of such a solution.

I'm wondering if you could recommend us any other technique for this task, poss开发者_开发技巧ibly with less overhead (when requesting simple sets of data - as in our case - I'm afraid the HTTP headers are very significant part of data)


I would suggest looking into node.js and the now.js plugging, which allows for realtime updates via websockets. It even has support for older browsers, so if the browser does not support websockets, it will do a fall over to either a comet server implementation, AJAX or an iframe.

It's extremely easy to setup on a linux environment, and there's ample documentation to get you started.

It works with javascript and runs on the Google V8 javascript engine, so if you've ever worked with OOP Javascript, you should be able to pick it up relatively easy.

LINKS:
http://nodejs.org/
http://nowjs.com/


How about Adobe AIR as front-end? You can use Flash/FLEX inside which have decent garbage collectors so long running shoudn't be a problem. AIR also allows to write in XHTML and JavaScript so it could be a good option if you're only familiar with those technologies

PHP is not a good choice for this kind of requests. Comet seems to be a good way to receive data from server. You can use for example excellent Tornado (Python) as backend.

ActionScript allows to use TCP sockets so you can write your own protocol for even better performance and use BOOST Asio (C++) or Netty (Java) as scalable backend


Maybe websocket ? Instead of making an AJAX request each X seconds, the server push new data as they comes.


My personal faverite is php4+, mysql, apache or lightpd webserver.

Tough I also suggest Python.

I specialize in what you are mentioning, with that said, will you be actually looking at the screen? If not you should request the page using an http socket or via a wget cronjob on a linux box.

Yes the http header is very important, if you try to strip them out the webserver will issue a "Server - Bad Request" Error.

Let me know what you decide, I have a lot to share :)


I suspect that the problem is not AJAX per se, but using a browser an sich: I don't think any where made with constant running in mind, and I'm assuming that all (re)loading processes will become some form of extra memory in the end.

I think you would be best off to consume your data trough something simple you design yourself. You can obviously produce it on the same spot (server, requestable via HTTP or whatever you like most), but you do not need a complete webbrowser if your goal is first "a couple of years uptime".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜