开发者

Can node.js be integrated with php?

开发者_如何学C

is that even a good idea for scaling heavy php apps ? for example, how does node's mysql module compare to php's mysqli extension in terms of performance etc ..


I'd seriously consider wrapping your PHP app with node.js; that is, having a migration path of your existing PHP being called by your node code, eventually migrating the PHP code into Javascript. The reason being, the execution model of node.js (non-blocking) doesn't really play well with PHP's execution model. That said, the execution models can be made more compatible with a wrapping approach; that is, having node be your exposed server, and making appropriate PHP calls (re-request); you can likely use that process to "migrate" your "wrapped" PHP over to a node server, then slowly migrate your PHP code to node.

Of course, this begs the question of whether or not you really even need / want to do this, but that's for you to determine...


There are some pretty good mysql libraries available in node.js with okay performance, but I would just rewrite(because you will still have to do a lot of coding when you use mysql libraries) the slow parts in node.js using redis or mongodb and just keep the rest in PHP. Especially redis with node_redis(hiredis) is very fast. You can use NGinx to do the proxing.


Output the result or data fetch from mysql via Nodejs is better than via LAMP.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜