• Stars
    star
    202
  • Rank 193,691 (Top 4 %)
  • Language
    C
  • Created over 12 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

mod_mruby: A Fast and Memory-Efficient Apache httpd Extension Mechanism Scripting with mruby

mod_mruby

mod_mruby: A Fast and Memory-Efficient Apache httpd Extension Mechanism Scripting with mruby.

Documents

ngx_mruby mod_mruby performance

β€» hello world simple benchmark, see details of blog entry.

What's mod_mruby

mod_murby is A Fast and Memory-Efficient Web Server Extension Mechanism Using Scripting Language mruby for 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 Apache modules by Ruby on Apache httpd.
  • You can implement some Web server software extensions by same Ruby code (as possible)
  • mod_mruby is to provide an alternative to mod_lua or ngx_mruby of nginx.
  • Supported Apache Version: 2.2 2.4
  • Supported Apache MPM: worker prefork event
  • Supported OS: Linux FreeBSD Windows and so on.
# Apache httpd.conf
# mrubyTranslateNameMiddle "/path/to/proxy.rb"
#

backends = [
  "http://192.168.0.101:8888/",
  "http://192.168.0.102:8888/",
  "http://192.168.0.103:8888/",
  "http://192.168.0.104:8888/",
]

# write balancing algorithm here.

r = Apache::Request.new()

r.handler  = "proxy-server"
r.proxyreq = Apache::PROXYREQ_REVERSE
r.filename = "proxy:" + backends[rand(backends.length)] + r.uri

Apache::return(Apache::OK)
  • see example
  • 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 ngxin.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!"

Abstract

As the increase of large-scale and complex Web services, not only a development of Web applications but also an implementation of Web server extensions is required in many cases. The Web server extensions were mainly implemented in C language because of fast and memory-efficient behavior, but extension methods using scripting language are proposed with consideration of maintainability and productivity. However, if the existing methods 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 fast, memory-efficiency and safety. Therefore, we propose a fast and memory-efficient Web server extension mechanism using scripting language. We design the architecture that a server process create the region to save the state of the interpreter at the server process startup, and multiple scripts share the region in order to process fast when the script is called as internal processing from a Web server process. The server process free the global variables table, the exception flag and the byte-code which cause the increase of memory usage mainly, in order to reduce the memory usage and extend safely by preventing interference between each scripts because of sharing the region. We implement the mechanism that can extend the internal processing of Apache easily by Ruby scripts using Apache and embeddable scripting language mruby. It's called "mod_mruby".

License

under the MIT License:

More Repositories

1

ngx_mruby

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

rcon

rcon is a lightweight resource virtualization tool for linux processes. This is one-binary.
Ruby
378
star
3

trusterd

Trusterd: High Performance HTTP/2 Web Server scripting with mruby
Ruby
171
star
4

http-dos-detector

detect huge number of http access like DoS for Apache and nginx using mruby
Ruby
90
star
5

pmilter

Pmilter: Programmable Mail Filter Server Scripting with mruby
C++
81
star
6

mruby-redis

redis class for mruby.
C
49
star
7

mruby-http2

HTTP2 Module for mruby
C
44
star
8

mruby-mrbgem-template

mrbgem template generater
Ruby
35
star
9

mruby-vedis

vedis binding by mruby
C
34
star
10

dovecot-mruby-plugin

Programmable IMAP Server Scripting with mruby
C
30
star
11

libcgroup

C
30
star
12

mruby-simplehttpserver

mruby-simplehttpserver is a HTTP Server with less dependency for mruby
Ruby
26
star
13

k2i

Kernel Parameters Interface using HTTP
Rust
25
star
14

mod_process_security

mod_process_security is an access control module for CGI and DSO. Improvement of mod_ruid2(vulnerability) and mod_suexec(performance).
C
23
star
15

pfds

pfds - report a snapshot of the current processes fd
Ruby
19
star
16

mruby-cross-compile-on-mac-osx

Cross compile osx, linux or win32 binary of mruby on Mac OSX.
Ruby
19
star
17

mruby-virtualing

creating jail environment, limiting resouces, assigning IP address and separating filesystem
Ruby
19
star
18

mruby-cgroup

mruby-cgroups
C
18
star
19

ab-mruby

ab configured by mruby script.
C
18
star
20

mruby-httprequest

HttpRequest of iij/mruby support mruby/mruby using mruby-uv and mruby-http
Ruby
17
star
21

mruby-simplehttp

SimpleHttp of iij/mruby support mruby/mruby using mruby-uv and mruby-http
Ruby
17
star
22

matsumotory

my research and development archivements
HTML
16
star
23

tcpriv

tcpriv: Access Control Architecture Separating Privilege Transparently via TCP Connection Based on Process Information
C
16
star
24

docker-ngx_mruby

ngx_mruby using docker
Dockerfile
14
star
25

mruby-changefinder

ChangeFinder class detect change points via continuous outlier and smoothing.
Ruby
14
star
26

qos-control

qos-control.pl
Perl
13
star
27

mod_vhost_maxclients

MaxClients per vhost, no using shared memory and global lock. mod_vhost_maxclients use only scoreboad for stability, high compatibility and simple implementation.
C
13
star
28

mruby-userdata

When shared mrb_state, you can share userdata objects between one Ruby code and another is shared mrb_state.
C
12
star
29

mruby-on-Lua

mruby on Lua.
C
11
star
30

mruby-criu

CRIU, Checkpoint Restart In Userspace for Linux, bindig for mruby
C
10
star
31

procps-sys

Interface procps library from Rust
Rust
10
star
32

http-access-limiter

Count the number of references to the requested parameter on Apache and Nginx using mruby code.
Ruby
9
star
33

mruby-rcon

lightweight virtualization tool for linux processes module for mruby
Ruby
9
star
34

resources-managed-tools

managed resources tools using cfs and cgroups.
Perl
9
star
35

mruby-discount

mruby html generater from markdown
C
9
star
36

synciga

Assembly
8
star
37

ngx_custom_worker_module

ngx_custom_worker_module can set the number of processes with any factor of worker_processes auto.
C
8
star
38

mruby-capability

mruby-capability
C
8
star
39

mruby-memcached

libmemcached bindings by mruby
C
8
star
40

mod_extract_forwarded_for_2.4

mod_extract_forwarded for Apache httpd 2.4.*
C
7
star
41

mruby-mutex

mutex class for mruby
C
7
star
42

mruby-oauth

refactored oauth of iij/mruby using mruby-uv and mruby-http
Ruby
7
star
43

mruby-localmemcache

Mruby Inter Process Share Memory. Exchange memory space with mmap for multi mruby process.
C
7
star
44

mruby-sleep

mruby-sleep
C
7
star
45

middlecon

middleware conversation using Rust
Rust
6
star
46

h2o_mruby

h2o_mruby - A Fast and Memory-Efficient Web Server Extension Mechanism Using Scripting Language mruby for h2o
C
5
star
47

piotop

piotop
Perl
5
star
48

mruby-fast-remote-check

FastRemoteCheck can perform port listening check at high speed using raw socket
C
5
star
49

build-kernel-4.x-for-centos6

kernel-4.x build system for CentOS6 on CentOS6
Makefile
5
star
50

fish-ghq-vscode

Search and open a git repository as vscode project or a specified file of the repository by vscode.
Shell
5
star
51

mruby-lruc

C
4
star
52

mruby-disque

Disque client for mruby
Ruby
4
star
53

mod_request_dumper

output request_rec, server_rec, conn_rec on earch hook phases.
C
4
star
54

mruby-spdy

SPDY Module for mruby
C
4
star
55

kernel-4-build-system-for-centos6

kernel rpm of CentOS6 build system on OS X
Ruby
4
star
56

mruby-eventfd

Eventfd class
C
4
star
57

mruby-config

C
4
star
58

mod_resource_checker

Process Resource Logging Module using JSON format into file or piped program
C
4
star
59

mruby-pointer

Provide mruby C API which shared pointer between two mrb_states
C
3
star
60

mruby-random

mruby-random
C
3
star
61

mruby-tinymt

rand() and srand() method with TinyMT
C
3
star
62

check-tcport

Listen check tool via ipaddr, port and uid
C
3
star
63

mod_fileownercheck

This module resolve TOCTOU with FollowSymlinks
C
3
star
64

mruby-ngx-mruby-ext

Extended Nginx class for ngx_mruby. You can exnted Nginx class by mrbgem.
Ruby
2
star
65

mruby-netlink

libnetlink binding for mruby
C
2
star
66

mod_resource_manager

mod_resource_manager
C
2
star
67

release-code

release code by matsumoto_r
C
2
star
68

mruby-simpletest

Simple Test Using assert
Ruby
2
star
69

mod_process_name

mod_process_name
2
star
70

tcp_save_syn_listen

listen() with TCP_SAVE_SYN using LD_PRELOAD
C
2
star
71

capcon

Ruby
2
star
72

ipmi-control-tool

ipmi-control-tool
2
star
73

mruby-zabbix

zabbix 2.0 API client for mruby using mruby-httprequest.
Ruby
2
star
74

Create-IP-List-from-JPNIC

Create-IP-List-from-JPNIC
Perl
2
star
75

mruby-growthforecast

growthforecast class for mruby
Ruby
1
star
76

auth_tcpriv

C
1
star
77

Zabbix-API-Client

Zabbix-API-Client for perl
Perl
1
star
78

test-code

test
1
star
79

mod_zabbix

mod_zabbix is .....
1
star
80

mruby-mod-mruby-ext

Ruby
1
star
81

mod_vlimit

mod_vlimit
C
1
star
82

lua-get-resources

lua-get-resources lib for mod_lua
1
star
83

node-sample-chat

websocket sample chat for node.js and socket.io.
1
star
84

patch-for-apache

patch for Apache HTTP Server and Apache modules
1
star
85

Perl-Supporter

Perl module supporting code.
1
star
86

mruby-uname

system uname bindings
C
1
star
87

mod_vlimitconn

mod_vlimitconn
1
star
88

mod_load_monitor

mod_load_monitor - exec command over threshold of load average
C
1
star
89

mruby-geoip

GeoIP mrbgem using GeoIPCity.dat
C
1
star
90

ngx_mrubyc

ngx_mrubyc has less memory usage than ngx_mruby. ngx_mruby is a simpler extension mechanism of nginx with Ruby without GC.
1
star
91

randammer

put irc message from tweet of randam users.
Ruby
1
star
92

mod_lalimit

mod_lalimit
C
1
star
93

ngx_http_mruby

mruby shim for nginx
C
1
star
94

build_my_mruby

build my mruby
Shell
1
star
95

rcheck-analyzer

analyze mod_resource_checker log
Ruby
1
star