Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

evt

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

evt

  • 0.4.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Evt

The Event Library that designed for Ruby 3.0 Fiber Scheduler.

This gem is still under development, APIs and features are not stable. Advices and PRs are highly welcome.

CI Tests Build Gem Version Downloads

Features

IO Backend Support

LinuxWindowsmacOSFreeBSD
io_uring⚠️ (See 1)
epoll✅ (See 2)
kqueue✅ (⚠️ See 5)
IOCP❌ (⚠️See 3)
Ruby (IO.select)✅ (See 6)✅ (⚠️See 4)✅ (See 6)✅ (See 6)
  1. when liburing is installed. (Currently fixing)
  2. when kernel version >= 2.6.9
  3. WOULD NOT WORK until FILE_FLAG_OVERLAPPED is included in I/O initialization process.
  4. Some I/Os are not able to be nonblock under Windows. Using POSIX select, SLOW. See Scheduler Docs.
  5. kqueue performance in Darwin is very poor. MAY BE DISABLED IN THE FUTURE.
  6. Using poll

Benchmark

The benchmark is running under v0.3.6 version. See example.rb in midori for test code, the test is running under a single-thread server.

The test command is wrk -t4 -c8192 -d30s http://localhost:8080.

All of the systems have set their file descriptor limit to maximum. On systems raising "Fiber unable to allocate memory", sudo sysctl -w vm.max_map_count=1000000 is set.

OSCPUMemoryBackendreq/s
LinuxRyzen 2700x64GBepoll2035742.59
LinuxRyzen 2700x64GBio_uringrequire fixes
LinuxRyzen 2700x64GBIO.select (using poll)1837640.54
macOSi7-6820HQ16GBkqueue257821.78
macOSi7-6820HQ16GBIO.select (using poll)338392.12

We also test the server with Redis request, with a monkey-patched redis library. The example code is following:

require 'evt'
require 'midori'
require 'midori-contrib/redic'

Fiber.set_scheduler Evt::Scheduler.new
REDIS = Redic.new

class HelloWorldAPI < Midori::API
  get '/' do
    REDIS.call 'GET', 'foo'
  end
end

Fiber.schedule do
  Midori::Runner.new(HelloWorldAPI).start
end

The benckmark result is as following:

OSCPUMemoryBackendreq/s
LinuxRyzen 2700x64GBepoll378060.30
macOSi7-6820HQ16GBkqueue204460.32

Install

gem install evt

Usage

require 'evt'

rd, wr = IO.pipe
scheduler = Evt::Scheduler.new

Fiber.set_scheduler scheduler

Fiber.schedule do
  message = rd.read(20)
  puts message
  rd.close
end

Fiber.schedule do
  wr.write("Hello World")
  wr.close
end

# "Hello World"
Windows WaitFor...Windows selectWindows IOCPio_uringepollkqueuepoll*NIX select
Anonymous Pipe
Named Pipe
Socket
File

Roadmap

  • Support epoll/kqueue/select
  • Upgrade to the latest Scheduler API
  • Support io_uring
  • Support iov features of io_uring
  • Support IOCP (NOT ENABLED YET)
  • Setup tests with Ruby 3
  • Selectable backend compilation by environment variable
  • Support IOCP with iov features
  • Setup more tests for production purpose
  • Documentation for usages

FAQs

Package last updated on 25 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc