As of March 2008, MySQL Heap Engine of any version is limited to fixed row format. It allocates fixed memory size for each record stored in a given Heap Table. For example, if table A has a VARCHAR(4000) column, MySQL will use at least 4000 bytes (plus other columns and per-record overhead) for every record regardless of whether it has that much user data. In this example, the table will use 4GB memory per 1M records.
类别:Mysql 查看评论
/** 异步处理的例子,可以不马上返回,但是必须一次返回 */ public void handleRequest( HttpServiceContext context ) throws Exception { context.addClientListener( new HttpClientListener() { public void clientDisconnected( HttpServiceContext ctx ) { }
public void clientIdle( HttpServiceContext ctx, long idleTime, int idleCount ) { // do something... // context.commitResponse(...) } }); }
所以Asyncweb如果用来做一个专业的comet http server还需要修改source code,所以目前成熟的做法还是用Jetty or Tomcat,另外在网上见到说GlassFish中的Grizzly使用修改了asyncweb实现了comet功能,或许那个1年多前的修改版本更值得借鉴。
Jetty 的Comet实现从编程的角度是最简单的,suspend的时候本次执行就结束了。
public class ForeverFrameJettyServlet extends HttpServlet { public void service(HttpServletRequest req, HttpServletResponse resp) throws IOException { // handle the time request if (req.getRequestURI().endsWith("/time")) { // get the jetty continuation Continuation cc = ContinuationSupport.getContinuation(req, null);
// set the header resp.setContentType("text/html");
// write time periodically while (true) { cc.suspend(1000); // suspend the response resp.getWriter().println("test"); resp.getWriter().flush(); } }
Resource:
1. Asynchronous HTTP and Comet architectures
An introduction to asynchronous, non-blocking HTTP programming
http://www.javaworld.com/javaworld/jw-03-2008/jw-03-asynchhttp.html
2. AsyncWeb Performance Test 与Apache2性能比较
类别:Web Im 查看评论
由于maillist刚创建,现在不少人在自我介绍,包括XMPP与mobile, web, social game, p2p音乐, 电子书分享等整合的领域。
目前考虑到的思路
1. 目前讨论的思路是利用XMPP现有的roster好友管理,pub/sub分享/订阅等协议来实现一个social network的功能,由于roster,pub/sub已经有很长时间的应用基础,而且也有大型分布式的一些成熟模块。目前的局限就是这些功能还是限制在xmpp client的使用层面,没有在Web或者更广泛的层面发挥作用。
One of the things I've talked a bit about is how useful some of the core xmpp tools would be to developers of social networks (say using the roster tools, which would automatically handle registration, friending, defriending etc. but do it on a giant scale and distributedly). Getting this data out of xmpp right now though, is by and large limited to people with access to xmpp clients. This wouldn't be so bad but it's a pain in the butt to spin up thousands and thousands of xmpp clients to access people friendship data.
2. XMPP组织下一步web & xmpp 整合是一个重心
James Walker wrote:
> particularly if we'll be
> discussing integrating web & xmpp stuff.
You betcha, that's the big focus here.
Peter
3. 一些其他观点和思路值得借鉴
I'm Bill de hÓra, engineering director at NewBay Software. At work we're looking at XMPP to push out notifications, status and alerts from web systems, social networks and phones to non-web clients. Polling and managing large user numbers (rosters!) is a big deal there. I also co-edited the Atom Protocol and as a long time XMPP fan, having Atom travel over XMPP as well as the Web is a natural next step :)
邮件列表Web查看:
http://mail.jabber.org/pipermail/social/2008-March/thread.html
修改部分的Source code
/* add function for send to comet */ void notify_comet(char *key, char *str) { int nudge = atoi(key); if (requests[nudge] != NULL) { evbuffer_add_printf(bufs[nudge], "Oops, from memcache: %s!\r\n", str); evhttp_send_reply_chunk(requests[nudge], bufs[nudge]); } }
/* * we get here after reading the value in set/add/replace commands. The command * has been stored in c->item_comm, and the item is ready in c->item. * 这个函数完全修改了 */ void complete_nread(conn * c) { item *it = &(c->item);
int comm = c->item_comm;
int ret;
stats.set_cmds++;
while (1) { if (strncmp(ITEM_data(it) + it->nbytes - 2, "\r\n", 2) != 0) { out_string(c, "CLIENT_ERROR bad data chunk"); break; } out_string(c, "STORED");
// send to comet server notify_comet(ITEM_key(it), ITEM_data(it)); break; }