https://github.com/matsumotory/ngx_mruby Skip to content Toggle navigation Sign up * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code + Explore + All features + Documentation + GitHub Skills + Blog * Solutions + By Plan + Enterprise + Teams + Compare all + By Solution + CI/CD & Automation + DevOps + DevSecOps + Case Studies + Customer Stories + Resources * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles + Repositories + Topics + Trending + Collections * Pricing [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this user All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} matsumotory / ngx_mruby Public * Notifications * Fork 110 * Star 939 ngx_mruby - A Fast and Memory-Efficient Web Server Extension Mechanism Using Scripting Language mruby for nginx ngx.mruby.org/ 939 stars 110 forks Star Notifications * Code * Issues 19 * Pull requests 3 * Actions * Projects 0 * Wiki * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Wiki * Security * Insights matsumotory/ngx_mruby This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. master Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags 39 branches 79 tags Code * Clone HTTPS GitHub CLI [https://github.com/m] Use Git or checkout with SVN using the web URL. [gh repo clone matsum] Work fast with our official CLI. Learn more. * Open with GitHub Desktop * Download ZIP Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching Xcode If nothing happens, download Xcode and try again. Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commit @matsumotory matsumotory Bump up version to v2.2.5 ... 930364b Sep 8, 2022 Bump up version to v2.2.5 930364b Git stats * 1,924 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .github .vscode dependence/ngx_devel_kit docker docs example misc mrbgems mruby src test .clang-format .gitignore .gitmodules .travis.yml AUTHORS Dockerfile LEGAL MITL Makefile.in README.md Vagrantfile apply-clang-format build.sh build_config.rb config.in configure configure.in nginx_version test.sh update-devkit-subtree update-mruby-subtree View code Documents What's ngx_mruby Abstract Contributions Backers Sponsors License README.md ngx_mruby ngx_mruby: A Fast and Memory-Efficient Nginx Extension Mechanism Scripting with mruby. [6874747073] [6874747073] [6874747073] [6874747073] Documents * Install * Test * Directives * Class and Method * Use Case * Examples 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 # # # mrubyHandlerMiddle "/path/to/unified_hello.rb" # # # 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] [6874747073] 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: * http://www.opensource.org/licenses/mit-license.php About ngx_mruby - A Fast and Memory-Efficient Web Server Extension Mechanism Using Scripting Language mruby for nginx ngx.mruby.org/ Topics nginx mruby ngx-mruby Resources Readme Stars 939 stars Watchers 48 watching Forks 110 forks Releases 63 ngx_mruby v2.2.5 Latest Sep 8, 2022 + 62 releases Packages 0 No packages published Contributors 49 * @matsumotory * @yyamano * @sawanoboly * @pyama86 * @cubicdaiya * @hfm * @yano3 * @hsbt * @kenhys * @charlescui * @Zogoo + 38 contributors Languages * C 69.3% * Ruby 21.5% * Yacc 5.2% * Shell 2.1% * C++ 1.6% * M4 0.2% * Other 0.1% Footer (c) 2022 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.