A comparative analysis of high performance Web server PHP vs. JS vs Nginx-lua

Source: Internet
Author: User

1. Ngx_lua nodejs php comparison

After studying for a while, I found that the LUA syntax and JS really resemble each other, while the Ngx_lua model is also single-threaded asynchronous event-driven and works the same way as Nodejs, and the code is even better written than the Nodejs asynchronous callbacks. Ngx_lua

Performance test, 100 concurrent php:17400nodejs:31197ngx_lua:32628

Simply doing the HTTP proxy server with some simple logic seems to be more appropriate for the Ngx_lua scenario. Citation: PHP vs node. js vs Nginx-lua

The following is an analysis of the resources consumed:from:phpnode Lua can be seen in the diagram:Nodejs consumes more CPU than LUA, Nodejs and Ngx_lua both consume memory (while processing the same business logic), PHP takes up a memory instability (possibly related to multithreading, more connections, more memory)
The following ape friends on Ngix_lua some views:

XUEYANGKK

In fact, this consideration is right! Ngx_lua is an nginx-based extension nginx has been verified by countless homes he is indeed a reliable web application. And Ngx_lua has a lot of extensive applications can be said technically mature, your platform is a OPANAPI application. So in this election Ngx_lua is right! Of course it's not that node is bad! Language is nothing good or bad! Only from the cost of technical maturity to consider!

Jayceefun

Before using the chapter Big God Openresty, it is really worth a try, than node. js easy to use, not so naked, do all kinds of performance optimizations are C-level, just out of time is also known as concurrency over node. js. Lua is really fast, it is said to be the fastest in the scripting language. However, there are shortcomings are LUA file processing is very weak, a variety of libraries are very small, remember the original wanted a good ORM are not, also have to hand-written. Agree with the landlord said Lua to a certain extent is really like JS, the original transformation node. JS language also basically did not pay much strength. It is recommended that one of the things that is written with Lua completely mimic node. js, called Luvit, is now completely immature, with only a few simple HTTP server features, but the underlying performance test results are twice times faster or 4 times times more than node. js, and it's scary.

Conclusion:number of concurrent requests Lua/nodejs equivalent, one times faster than PHPThe resource occupies the least Lua, Nodejs, the two are not greedy for memory, PHP occupies the most and is not stable.

2. Nodejs python php comparison

An ape friend from abroad did a performance comparison between Php/nodejs/go/scala/python:API programming Language Bake-Off The following test cases are the maximum number of requests per second that are processed by each language when you use MongoDB to add delete data: As you can see, the test scripts written by Go and PHP are all hung up when the concurrent threads reach a certain level (go is not known as the fastest?). )

The evaluation of two other Chinese ape friends also proves this point,1. test the Nodejs and PHP performance 2. single-server node. JS and PHP performance testing in their conclusion, node. JS has twice times more concurrent processing power than PHP.

Conclusion:in general, Python and node. JS processing power is twice times the same as PHP, when the number of concurrent to a certain program, PHP may hang, may originate from the multi-threaded memory resource consumption is not measurable. Citation: http://bbs.phpchina.com/thread-278161-1-1.htmlAdditional test report: Http://bluehua.org/demo/php.node.lua.html

A comparative analysis of high performance Web server PHP vs. JS vs Nginx-lua

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.