CARVIEW |
Select Language
HTTP/2 302
server: nginx
date: Fri, 22 Aug 2025 11:51:09 GMT
content-type: text/plain; charset=utf-8
content-length: 0
x-archive-redirect-reason: found capture at 20090417005812
location: https://web.archive.org/web/20090417005812/https://github.com/oldmoe/reactor/tree/master
server-timing: captures_list;dur=0.464479, exclusion.robots;dur=0.020700, exclusion.robots.policy;dur=0.011650, esindex;dur=0.008824, cdx.remote;dur=12.756219, LoadShardBlock;dur=316.239737, PetaboxLoader3.datanode;dur=176.250108, PetaboxLoader3.resolve;dur=93.460506
x-app-server: wwwb-app200
x-ts: 302
x-tr: 351
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=1
set-cookie: wb-p-SERVER=wwwb-app200; path=/
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
HTTP/2 200
server: nginx
date: Fri, 22 Aug 2025 11:51:11 GMT
content-type: text/html; charset=utf-8
x-archive-orig-server: nginx/0.6.26
x-archive-orig-date: Fri, 17 Apr 2009 00:58:10 GMT
x-archive-orig-connection: close
x-archive-orig-set-cookie: _github_ses=BAh7BzoOcmV0dXJuX3RvIh0vaGlyYWZvby9uaWdldC93aWtpcy9uZXciCmZsYXNoSUM6J0FjdGlvbkNvbnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhhc2h7AAY6CkB1c2VkewA%3D--86ea8f0af7f035a8f68d195c053f26b11cc38da8; path=/; expires=Wed, 01 Jan 2020 08:00:00 GMT; HttpOnly
x-archive-orig-status: 200 OK
x-archive-orig-x-runtime: 1070ms
x-archive-orig-etag: "b3fd66c32c537a87ace35794a2129d38"
x-archive-orig-cache-control: private, max-age=0, must-revalidate
x-archive-orig-content-length: 17981
x-archive-guessed-content-type: text/html
x-archive-guessed-charset: utf-8
memento-datetime: Fri, 17 Apr 2009 00:58:12 GMT
link: ; rel="original", ; rel="timemap"; type="application/link-format", ; rel="timegate", ; rel="first memento"; datetime="Fri, 17 Apr 2009 00:58:12 GMT", ; rel="memento"; datetime="Fri, 17 Apr 2009 00:58:12 GMT", ; rel="next memento"; datetime="Sun, 19 Apr 2009 07:33:48 GMT", ; rel="last memento"; datetime="Sun, 30 Oct 2016 20:08:11 GMT"
content-security-policy: default-src 'self' 'unsafe-eval' 'unsafe-inline' data: blob: archive.org web.archive.org web-static.archive.org wayback-api.archive.org athena.archive.org analytics.archive.org pragma.archivelab.org wwwb-events.archive.org
x-archive-src: 52_9_20090416213800_crawl102-c/52_9_20090417005753_crawl101.arc.gz
server-timing: captures_list;dur=0.547455, exclusion.robots;dur=0.025604, exclusion.robots.policy;dur=0.014669, esindex;dur=0.009449, cdx.remote;dur=666.862763, LoadShardBlock;dur=771.592659, PetaboxLoader3.datanode;dur=137.865830, PetaboxLoader3.resolve;dur=721.133402, load_resource;dur=139.983679
x-app-server: wwwb-app200
x-ts: 200
x-tr: 1659
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
content-encoding: gzip
oldmoe's reactor at master - GitHub
This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (

This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (

Description: | A simple, pure Ruby reactor library |
Clone URL: |
git://github.com/oldmoe/reactor.git
Give this clone URL to anyone.
git clone git://github.com/oldmoe/reactor.git
|
reactor /
name | age | message | |
---|---|---|---|
![]() |
README | Loading commit data... ![]() |
|
![]() |
lib/ | ||
![]() |
reactor.gemspec | Wed Apr 15 16:57:34 -0700 2009 | no send for sockets, ouch. Using __send__ [oldmoe] |
Reactor A reactor library with the very original name of "Reactor". What is a reactor any way? A reactor library is one that provides an asynchronus event handling mechanism. Ruby already has a couple of those. The most prominent are EventMachine and Rev. Many high performing Ruby applications like Thin and Evented Mongrel are utilizing EventMachine for event handling. Both Rev and EventMachine build atop native reactor implementations written in C or C++. While this ensures high performance it makes some integration aspects with Ruby a bit quirky. Sometimes even at a noticable performance cost. This is why I thought of building Reactor. A much simpler reactor library in pure Ruby that attempts to use as much of the Ruby built in classes and standard libraries as possible. It only provides a minimal API that does not attempt to be so smart. It differs from EventMachine and Rev in the following aspects. 1 - Pure Ruby, no C or C++ code involved 2 - Very small (~100 lines of code) 3 - Uses the vanilla Ruby socket and server implementations 4 - Decent (high) performance on Ruby 1.9.1 5 - Ruby threading friendly (naturally) 6 - You can have multiple reactors running (like Rev and unlike EventMachine) Usage is simple, here's a simple Echo server that uses Reactor require 'reactor' require 'socket' reactor = Reactor::Base.new server = TCPServer.new("0.0.0.0",8080) reactor.attach(:read, server) do |server| conn = server.accept conn.write(conn.gets) conn.close end reactor.run # blocking call, will run for ever (no signal handling currently) The server is a normal Ruby TCPServer. It attaches itself to the reactor and asks to be notified if there is data to be read on the wire. A block is provided that will handle those notifications. Alternatively, the server can implement a notify_readable method that will be fired instead. Any IO object can be attached to the reactor but it doesn't make much sense to attach actual files since they will block upon reading or writing anyway. Sockets and pipes will work in a non-blocking manner though. Reactor is using Ruby's IO.select behind the scenes. This limits its ability to scale in comparison to something like EventMachine or Rev which are able to utilize Epoll and Kqueue which scale much better. This is not a major concern though. Most servers listen to a few fds most of the time, which is a bit faster when using select. Besides one can hope that Ruby will be able to use Epoll and Kqueue some day which will translate to direct benefit to Reactor. Todo The timers code needs to be reimplemented as a red black tree or a skip list to avoid the current O(n) cost. It works just fine at its current form for a few timers though (tens or even hundreds)
This feature is coming soon. Sit tight!