Thursday, October 23, 2014

Enter OpenResty

Wonder if your applications will scale as more users will come and visit your site ? How about system's resources: CPU, Memory ? Probable you will need to add more and more capacity every 4-6 months !? And how quickly can you add or change things to your web application platform to keep up with the competition ?
You need something: fast, simple, easy to manage, simple to learn and develop. Enter OpenResty

What is it ?

A web development platform based on Lua and NGINX HTTP server, including various modules to speed up the web development. Think of it as a web application server with lots of ready modules to help your life. But it is not Java, PHP, Perl or Ruby. Its Lua.

"By taking advantage of various well-designed Nginx modules, OpenResty effectively turns the nginx server into a powerful web app server, in which the web developers can use the Lua programming language to script various existing nginx C modules and Lua modules and construct extremely high-performance web applications that are capable to handle 10K+ connections." http://openresty.org/

 

Is it fast ? 

Damn fast. Take a look below. We been porting our authentication application from Perl to Lua and NGINX and see lots of improvements and no need to buy new machines:

NGINX + Perl (Plack)
N=150, R=418ms, X=117req/sec, Util=75% (2vcpus)

NGINX + Perl (Mojo)
N=150, R=326ms, X=126req/sec, Util=63% (2vcpus) 

NGINX +Lua(OpenResty)
N=150, R=27ms, X=180req/sec, Util=12% (2vcpus)

where,
N = number virtual users
R = response time, ms
X = throughput, req/sec
Util = CPU Utilization across all CPU, percentage


Push more users and you will see the light.

So the winner is ... Lua and NGINX. Using Lua programming language we can craft nice web applications powered by NGINX HTTP server to sustain lots of users on decent computer systems without fear to upgrade every 3 months.

Big thanks to all OpenResty members to make this happen.

No comments:

Post a Comment