All Projects → matsumotory → Ngx_mruby

matsumotory / Ngx_mruby

ngx_mruby - A Fast and Memory-Efficient Web Server Extension Mechanism Using Scripting Language mruby for nginx

Programming Languages

c
50402 projects - #5 most used programming language

Labels

Projects that are alternatives of or similar to Ngx mruby

Httperrorpages
⏩ Simple HTTP Error Page Generator
Stars: ✭ 772 (-13.36%)
Mutual labels:  nginx
Docker Nginx Http3
Alpine Linux image with Nginx 1.19.4 (mainline) with HTTP/3 (QUIC), TLSv1.3, 0-RTT, brotli, NJS support, and 10 MB size. All built on the bleeding edge for max performance. Built on the edge, for the edge.
Stars: ✭ 820 (-7.97%)
Mutual labels:  nginx
Nginx Headers More Rpm
Nginx with headers-more-module rpm
Stars: ✭ 6 (-99.33%)
Mutual labels:  nginx
Nginx Demos
NGINX and NGINX Plus demos
Stars: ✭ 799 (-10.33%)
Mutual labels:  nginx
Nginx Docs
Nginx 中文文档. Chinese translation of Nginx documentation.
Stars: ✭ 809 (-9.2%)
Mutual labels:  nginx
Netboot Httpd
Docker container for serving netboot image over http. Use in combination with BSDPy
Stars: ✭ 5 (-99.44%)
Mutual labels:  nginx
Xray onekey
Xray 基于 Nginx 的 VLESS + XTLS 一键安装脚本
Stars: ✭ 7,012 (+686.98%)
Mutual labels:  nginx
Docker Node Nginx Alpine
Dockerfile to build an image with Nginx and Node (npm and yarn) on Alpine Linux
Stars: ✭ 16 (-98.2%)
Mutual labels:  nginx
Awesome Nginx
A curated list of awesome Nginx distributions, 3rd party modules, Active developers, etc.
Stars: ✭ 811 (-8.98%)
Mutual labels:  nginx
Amazon Scripts
Administrative scripts for my EC2 Amazon Linux based Meteor/Mongo/Nginx/Node/Passenger server
Stars: ✭ 6 (-99.33%)
Mutual labels:  nginx
Modsecurity Nginx
ModSecurity v3 Nginx Connector
Stars: ✭ 805 (-9.65%)
Mutual labels:  nginx
Huststore
High-performance Distributed Storage
Stars: ✭ 806 (-9.54%)
Mutual labels:  nginx
Docker Nginx Php5 Laravel5
A Dockerfile which produces a docker image that runs Ubuntu 14.04, Nginx, PHP5 for Laravel 5.
Stars: ✭ 5 (-99.44%)
Mutual labels:  nginx
Images
Source code of images.weserv.nl, to be used on your own server(s).
Stars: ✭ 798 (-10.44%)
Mutual labels:  nginx
Vestacp nginx pagespeed http2
Rebuild Nginx with Google PageSpeed and http/2 for VestaCP
Stars: ✭ 16 (-98.2%)
Mutual labels:  nginx
Hestiacp
Hestia Control Panel | A lightweight and powerful control panel for the modern web.
Stars: ✭ 764 (-14.25%)
Mutual labels:  nginx
K8s Elk Demo
A simple demonstration of the ELK stack on a Kubernetes cluster
Stars: ✭ 5 (-99.44%)
Mutual labels:  nginx
Flyapi
基于SSM layui 开发的多人博客系统,目标在于让每个人都能精准阅读和专注写作。
Stars: ✭ 16 (-98.2%)
Mutual labels:  nginx
Keyless Solution
The solution of keyless proxy.
Stars: ✭ 16 (-98.2%)
Mutual labels:  nginx
Dockerfiles
Dockerfiles I create that may or may not be useful.
Stars: ✭ 5 (-99.44%)
Mutual labels:  nginx

ngx_mruby

ngx_mruby: A Fast and Memory-Efficient Nginx Extension Mechanism Scripting with mruby.

Documents

What's ngx_mruby

ngx_mruby is A Fast and Memory-Efficient TCP/UDP Load Balancing and Web Server Extension Mechanism Using Scripting Language mruby for nginx.

  • ngx_mruby is to provide an alternative to lua-nginx-module or mod_mruby of Apache httpd.
  • Unified Ruby Code between Apache(mod_mruby), nginx(ngx_mruby) and other Web server software(plan) for Web server extensions.
  • You can implement nginx modules by Ruby scripts on nginx!
  • You can implement some Web server software extensions by same Ruby code (as possible)
  • Supported nginx main-line and stable-line
  • Benchmark between ngx_mruby and lua-nginx-module
# location /proxy {
#   mruby_set $backend "/path/to/proxy.rb";
#   proxy_pass   http://$backend;
# }

backends = [
  "test1",
  "test2",
  "test3",
]

r = Redis.new "192.168.12.251", 6379
r.get backends[rand(backends.length)]
  • see examples
  • Sample of Unified Ruby Code between Apache(mod_mruby) and nginx(ngx_mruby) for Web server extensions
  • You can implement some Web server software extensions by same Ruby code (as possible)
# Unified Ruby Code between Apache(mod_mruby) and nginx(ngx_mruby)
# for Web server extensions.
#
# Apache httpd.conf by mod_mruby
#
# <Location /mruby>
#     mrubyHandlerMiddle "/path/to/unified_hello.rb"
# </Location>
#
# nginx nginx.conf by ngx_mruby
#
# location /mruby {
#     mruby_content_handler "/path/to/unified_hello.rb";
# }
#

Server = get_server_class

Server::rputs "Hello #{Server::module_name}/#{Server::module_version} world!"
# mod_mruby => "Hello mod_mruby/0.9.3 world!"
# ngx_mruby => "Hello ngx_mruby/0.0.1 world!"

ngx_mruby mod_mruby performance

hello world simple benchmark, see details of blog entry.

Abstract

As the increase of large-scale and complex Web services, not only the development of Web applications is required, but also the implementation of Web server extensions in many cases. Most Web server extensions are mainly implemented in the C language because of fast and memory-efficient behavior, but by writing extensions using a scripting language we can achieve better maintainability and productivity.

However, if the existing methods are primarily intended to enhance not the implementation of Web applications but the implementation of internal processing of the Web server, the problem remains in terms of speed, memory-efficiency and safety.

Therefore, we propose a fast and memory-efficient Web server extension mechanism using a scripting language. We designed an architecture where the server process creates a region in memory to save the state of the interpreter at the server process startup, and multiple scripts share this region to process the scripts quickly when new request are made.

The server process frees the global variables table, the exception flag and the byte-code which cause an increase of memory usage, in order to reduce the memory usage and extend safety by preventing interference between each script because of sharing the region. We implemented a mechanism that can extend the internal processing of nginx easily by Ruby scripts using nginx and the embeddable scripting language mruby. It's called "ngx_mruby".

Contributions

This project exists thanks to all the people who contribute. We also welcome financial contributions in full transparency on our open collective.

Backers

Thank you to all our backers! 🙏 [Become a backer]

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]

License

This project is under the MIT License:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].