SlideShare a Scribd company logo
1 of 56
Download to read offline
Three Ruby usages 
Kouhei Sutou 
ClearCode Inc. 
RubyKaigi 2014 
2014/09/20 
Three Ruby usages Powered by Rabbit 2.1.4
Silver sponsor 
Three Ruby usages Powered by Rabbit 2.1.4
Goal 
You know three Ruby usages 
✓High-level interface 
✓Glue 
✓Embed 
✓ 
✓You can remember them later 
Three Ruby usages Powered by Rabbit 2.1.4
Targets 
High-level interface 
✓Pure Rubyists 
✓ 
Glue 
✓Rubyists who can write C/C++ 
✓ 
Embed 
✓Rubyists who also write C/C++ 
✓ 
Three Ruby usages Powered by Rabbit 2.1.4
Case study 
Implement distributed 
full-text search engine in 
Ruby 
Abbreviation: DFTSE = Distributed Full-Text Search Engine 
Three Ruby usages Powered by Rabbit 2.1.4
DFTSE? 
Distrubuted 
Full- 
Text 
Search 
Engine 
Full- 
Text 
Search 
Engine 
1: Full-text search 
2: Distribute 
sub requests 
3: Merge 
responses 
Three Ruby usages Powered by Rabbit 2.1.4
Why do we use DFTSE? 
I'm developing 
Droonga 
(A DFTSE implementation in Ruby) 
 
Three Ruby usages Powered by Rabbit 2.1.4
High-level interface 
Three Ruby usages 
High-level interface 
Target: ✓ Pure Rubyists 
✓ 
✓Glue 
✓Embed 
Three Ruby usages Powered by Rabbit 2.1.4
High-level interface 
Provides 
lower layer feature to 
higher layer 
✓ 
With simpler/✓ convenience API 
Three Ruby usages Powered by Rabbit 2.1.4
High-level interface 
Higher layer users 
High-level 
interface 
Feature 
by Yukihiro Matsumoto 
Application/Library 
Three Ruby usages Powered by Rabbit 2.1.4
Example 
Vagrant Active Record 
Developers 
Vagrantfile 
Build 
development 
environment 
Vagrant 
b y Y u k i h i r o M a t s u m o t o 
Developers 
Object based API 
b y Y u k i h i r o M a t s u m o t o 
Access data in RDBMS 
Active Record 
Three Ruby usages Powered by Rabbit 2.1.4
Droonga: High-level IF 
DFTSE components 
Full-✓ text search engine 
✓Messaging system 
✓Cluster management 
✓Process management 
Three Ruby usages Powered by Rabbit 2.1.4
Messaging system 
1: Full-text search DTFSE 
FTSE 
2: Distribute 
sub requests 
3: Merge 
responses 
Worker 
process 
Messaging 
system 
Three Ruby usages Powered by Rabbit 2.1.4
Messaging system 
Provides 
distributed search feature 
✓Plan how to search 
✓Distribute requests 
✓Merge responses 
✓ 
✓Users don't know details 
Three Ruby usages Powered by Rabbit 2.1.4
Characteristic 
Plan how to search 
May speed up/✓ down over 100 times 
✓ 
Distribute requests 
✓Network bound operation 
✓ 
Merge responses 
✓CPU and network bound operation 
✓ 
Three Ruby usages Powered by Rabbit 2.1.4
Point 
Algorithm is important 
Need to find new/existing better 
algorithm 
✓ 
"Rapid prototype and measure" 
feedback loop is helpful 
✓ 
Ruby is ✓ good at rapid dev. 
✓ 
Three Ruby usages Powered by Rabbit 2.1.4
Glue 
Three Ruby usages 
✓High-level interface 
Glue 
Target: 
Rubyists who can write C/C++ 
✓ 
✓ 
✓Embed 
Three Ruby usages Powered by Rabbit 2.1.4
Glue 
Export 
a feature 
Feature 
Combine 
features 
Glue 
Ruby 
Other 
Language 
Three Ruby usages Powered by Rabbit 2.1.4
Example 
mysql2 gem 
Vagrant 
Access to MySQL VM Provision 
libmysqlclient.so 
(VirtualBox) (Chef) 
Feature 
Active Record 
Glue 
Three Ruby usages Powered by Rabbit 2.1.4
Why do we glue? 
Reuse ✓ existing features 
Three Ruby usages Powered by Rabbit 2.1.4
How to glue 
Use external library 
Implement ✓ bindings (mysql2 gem) 
✓ 
Use external command 
✓Spawn command (Vagrant) 
✓ 
Use external service 
✓Implement client 
✓ 
Three Ruby usages Powered by Rabbit 2.1.4
Glue in Droonga 
Rroonga: Groonga bindings 
Groonga: ✓ FTSE C library (and server) 
✓ 
Cool.io: libev bindings 
libev: Event loop C library 
(Based on I/O multiplexing and non-blocking I/O) 
✓ 
✓ 
✓Serf: Clustering tool (in Droonga) 
Three Ruby usages Powered by Rabbit 2.1.4
Rroonga in Droonga 
1: Full-text search DTFSE 
FTSE 
2: Distribute 
sub requests 
3: Merge 
responses 
Worker 
process 
Messaging 
system 
Three Ruby usages Powered by Rabbit 2.1.4
FTSE in Droonga 
✓Must be fast! 
✓CPU bound processing 
Three Ruby usages Powered by Rabbit 2.1.4
For fast Rroonga 
Do heavy processing in C 
Nice to ✓ have Ruby-ish API 
✓ 
Less memory allocation 
✓Cache internal buffer 
✓ 
Multiprocessing 
✓Groonga supports multiprocessing 
✓ 
Three Ruby usages Powered by Rabbit 2.1.4
Search 
Groonga::Database.open(ARGV[0]) 
entries = Groonga["Entries"] 
entries.select do |record| 
record.description =~ "Ruby" 
end 
Three Ruby usages Powered by Rabbit 2.1.4
Search - Pure Ruby (ref) 
Groonga::Database.open(ARGV[0]) 
entries = Groonga["Entries"] 
entries.find_all do |record| 
# This block is evaluated for each record 
/Ruby/ =~ record.description 
end 
Three Ruby usages Powered by Rabbit 2.1.4
Search impl. 
# (2) Evaluate expression in C 
entries.select do |record| 
# (1) Build expression in Ruby 
# This block is evaluated only once 
record.description =~ "Ruby" 
end 
Three Ruby usages Powered by Rabbit 2.1.4
Search impl. - Fig. 
Ruby 
by Groonga project 
C 
entries.select do |record| 
record.description =~ "Ruby" 
end 
Build Search 
request 
Expression 
Result set 
Evaluate expression by Groonga project 
Three Ruby usages Powered by Rabbit 2.1.4
Search - Benchmark 
✓Ruby (It's already showed) 
✓C 
Three Ruby usages Powered by Rabbit 2.1.4
Search - C 
grn_obj *expr; 
grn_obj *variable; 
const gchar *filter = "description @ "Ruby""; 
grn_obj *result; 
GRN_EXPR_CREATE_FOR_QUERY(&ctx, table, expr, variable); 
grn_expr_parse(&ctx, expr, 
filter, strlen(filter), NULL, 
GRN_OP_MATCH, GRN_OP_AND, 
GRN_EXPR_SYNTAX_SCRIPT); 
result = grn_table_select(&ctx, table, expr, NULL, GRN_OP_OR); 
grn_obj_unlink(&ctx, expr); 
grn_obj_unlink(&ctx, result); 
Three Ruby usages Powered by Rabbit 2.1.4
Search - Benchmark 
Ruby impl. is fast enough  
Impl. Elapsed time 
C 0.6ms 
Ruby 0.8ms 
(Full-text search with "Ruby" against 72632 records) 
Three Ruby usages Powered by Rabbit 2.1.4
Embed 
Three Ruby usages 
✓High-level interface 
✓Glue 
Embed 
Target: 
Rubyists who also write C/C++ 
✓ 
✓ 
Three Ruby usages Powered by Rabbit 2.1.4
Embed 
Internal engine Interface 
C/C++ application 
C/C++ library 
Implement 
some features 
in Ruby 
Plugin API 
Conifugration 
by Yukihiro Matsumoto 
by Yukihiro Matsumoto C/C++ application 
C/C++ library 
Three Ruby usages Powered by Rabbit 2.1.4
Examples 
Internal engine Interface 
Implement 
query optimizer 
in Ruby 
vim-ruby by Yukihiro Matsumoto 
by Yukihiro Matsumoto VIM 
Three Ruby usages Powered by Rabbit 2.1.4
Embed in Droonga 
by Yukihiro Matsumoto 
by Yukihiro Matsumoto 
... 
by The Groonga Project 
by The Groonga Project 
by The Groonga Project 
mruby 
by Yukihiro Matsumoto 
Three Ruby usages Powered by Rabbit 2.1.4
CRuby vs. mruby 
CRuby 
✓Full featured! 
✓Signal handler isn't needed  
✓ 
mruby 
✓Multi-interpreters in a process! 
✓You may miss some features  
✓ 
Three Ruby usages Powered by Rabbit 2.1.4
mruby in Groonga 
✓Query optimizer 
Command interface (plan) 
✓Interface and also high-level interface! 
✓ 
Plugin API (plan) 
✓Interface! 
✓ 
Three Ruby usages Powered by Rabbit 2.1.4
Query optimizer 
Query 
Optimize Optimized 
Query 
Optimizer 
query 
Full-text search 
Evaluator 
by Yukihiro Matsumoto 
Result set 
Three Ruby usages Powered by Rabbit 2.1.4
Query optimizer 
Plan how to search 
✓It's a bother  
✓ 
✓Light operation than FTS 
Depends on data 
(Choose effective index, use table scan and so on) 
✓ 
Three Ruby usages Powered by Rabbit 2.1.4
Example 
rank < 200 && rank > 100 
Three Ruby usages Powered by Rabbit 2.1.4
Simple impl. 
rank 1 2 ... 100 ... 200 ... ... 
10000 
rank > 100 
rank < 200 
101 199 
&& 
101 ... 199 
rank < 200 && rank > 100 
Three Ruby usages Powered by Rabbit 2.1.4
Simple impl. 
Slow against 
many out of range data 
✓ 
Three Ruby usages Powered by Rabbit 2.1.4
Optimized impl. 
rank 1 2 ... 100 101 ... 199 
200 ... ... 
10000 
100 < rank < 200 
101 ... 199 
rank < 200 && rank > 100 
Three Ruby usages Powered by Rabbit 2.1.4
Is embedding reasonable? 
Measure 
Three Ruby usages Powered by Rabbit 2.1.4
Measure 
✓mruby overhead 
✓Speed-up by optimization 
Three Ruby usages Powered by Rabbit 2.1.4
Overhead 
Small overhead: Reasonable 
# conds mruby Elapsed 
1 ○ 0.24ms 
1 × 0.16ms 
4 ○ 0.45ms 
4 × 0.19ms 
Three Ruby usages Powered by Rabbit 2.1.4
Speed-up 
Fast for many data:Reasonable 
# records mruby no mruby 
1000 0.29ms 0.31ms 
10000 0.31ms 2.3ms 
100000 0.26ms 21.1ms 
1000000 0.26ms 210.2ms 
Three Ruby usages Powered by Rabbit 2.1.4
Note 
Embedding needs many works 
Write bindings, import mruby your 
build system and ... 
✓ 
✓ 
How to test your mruby part? 
✓And how to debug? 
✓ 
Three Ruby usages Powered by Rabbit 2.1.4
Conclusion
Conclusion 1 
Describe three Ruby usages 
✓High-level interface 
✓Glue 
✓Embed 
✓ 
Three Ruby usages Powered by Rabbit 2.1.4
Conclusion 2 
High-level interface 
✓ Target: Pure Rubyists 
✓ 
Provides lower layer feature to 
higher layer w/ usable interface 
✓Ruby's flexibility is useful 
✓ 
Three Ruby usages Powered by Rabbit 2.1.4
Conclusion 3 
Glue 
Target: 
Rubyists who can write C/C++ 
✓ 
Why: Reuse ✓ existing feature 
✓To be fast, do the process in C 
✓ 
Three Ruby usages Powered by Rabbit 2.1.4
Conclusion 4 
Embed 
Target: 
Rubyists who also write C/C++ 
✓ 
Why: 
Avoid bother programming by Ruby 
✓ 
✓ 
Three Ruby usages Powered by Rabbit 2.1.4
Conclusion 5 
Embed 
Is it reasonable ✓ for your case? 
✓You need many works 
✓ 
Very powerful 
if your case is reasonable 
✓ 
Three Ruby usages Powered by Rabbit 2.1.4
Announcement 
ClearCode Inc. 
✓A silver sponsor 
✓Is recruiting 
✓Will do readable code workshop 
✓ 
The next Groonga conference 
✓It's held at 11/29 
✓ 
Three Ruby usages Powered by Rabbit 2.1.4

More Related Content

What's hot

Kafka Summit SF 2017 - One Day, One Data Hub, 100 Billion Messages: Kafka at ...
Kafka Summit SF 2017 - One Day, One Data Hub, 100 Billion Messages: Kafka at ...Kafka Summit SF 2017 - One Day, One Data Hub, 100 Billion Messages: Kafka at ...
Kafka Summit SF 2017 - One Day, One Data Hub, 100 Billion Messages: Kafka at ...confluent
 
Performance Optimization of Rails Applications
Performance Optimization of Rails ApplicationsPerformance Optimization of Rails Applications
Performance Optimization of Rails ApplicationsSerge Smetana
 
Performance optimization 101 - Erlang Factory SF 2014
Performance optimization 101 - Erlang Factory SF 2014Performance optimization 101 - Erlang Factory SF 2014
Performance optimization 101 - Erlang Factory SF 2014lpgauth
 
Rails Application Optimization Techniques & Tools
Rails Application Optimization Techniques & ToolsRails Application Optimization Techniques & Tools
Rails Application Optimization Techniques & Toolsguest05c09d
 
Fighting Spam With A Perimeter Mail System 20071108 Sasag
Fighting Spam With A Perimeter Mail System 20071108 SasagFighting Spam With A Perimeter Mail System 20071108 Sasag
Fighting Spam With A Perimeter Mail System 20071108 Sasaggarrett honeycutt
 
[233] level 2 network programming using packet ngin rtos
[233] level 2 network programming using packet ngin rtos[233] level 2 network programming using packet ngin rtos
[233] level 2 network programming using packet ngin rtosNAVER D2
 
Peter Zaitsev "18 ways to fix MySQL bottlenecks"
Peter Zaitsev "18 ways to fix MySQL bottlenecks"Peter Zaitsev "18 ways to fix MySQL bottlenecks"
Peter Zaitsev "18 ways to fix MySQL bottlenecks"Fwdays
 
Robert Kubis - gRPC - boilerplate to high-performance scalable APIs - code.t...
 Robert Kubis - gRPC - boilerplate to high-performance scalable APIs - code.t... Robert Kubis - gRPC - boilerplate to high-performance scalable APIs - code.t...
Robert Kubis - gRPC - boilerplate to high-performance scalable APIs - code.t...AboutYouGmbH
 
Kafka Evaluation - High Throughout Message Queue
Kafka Evaluation - High Throughout Message QueueKafka Evaluation - High Throughout Message Queue
Kafka Evaluation - High Throughout Message QueueShafaq Abdullah
 
Galaxy CloudMan performance on AWS
Galaxy CloudMan performance on AWSGalaxy CloudMan performance on AWS
Galaxy CloudMan performance on AWSEnis Afgan
 
Scaling PostgreSQL with Skytools
Scaling PostgreSQL with SkytoolsScaling PostgreSQL with Skytools
Scaling PostgreSQL with SkytoolsGavin Roy
 
[231] the simplicity of cluster apps with circuit
[231] the simplicity of cluster apps with circuit[231] the simplicity of cluster apps with circuit
[231] the simplicity of cluster apps with circuitNAVER D2
 
Microservices summit talk 1/31
Microservices summit talk   1/31Microservices summit talk   1/31
Microservices summit talk 1/31Varun Talwar
 
Perl Dist::Surveyor 2011
Perl Dist::Surveyor 2011Perl Dist::Surveyor 2011
Perl Dist::Surveyor 2011Tim Bunce
 
Golang Performance : microbenchmarks, profilers, and a war story
Golang Performance : microbenchmarks, profilers, and a war storyGolang Performance : microbenchmarks, profilers, and a war story
Golang Performance : microbenchmarks, profilers, and a war storyAerospike
 

What's hot (20)

Kafka Summit SF 2017 - One Day, One Data Hub, 100 Billion Messages: Kafka at ...
Kafka Summit SF 2017 - One Day, One Data Hub, 100 Billion Messages: Kafka at ...Kafka Summit SF 2017 - One Day, One Data Hub, 100 Billion Messages: Kafka at ...
Kafka Summit SF 2017 - One Day, One Data Hub, 100 Billion Messages: Kafka at ...
 
Performance Optimization of Rails Applications
Performance Optimization of Rails ApplicationsPerformance Optimization of Rails Applications
Performance Optimization of Rails Applications
 
Performance optimization 101 - Erlang Factory SF 2014
Performance optimization 101 - Erlang Factory SF 2014Performance optimization 101 - Erlang Factory SF 2014
Performance optimization 101 - Erlang Factory SF 2014
 
Rails Application Optimization Techniques & Tools
Rails Application Optimization Techniques & ToolsRails Application Optimization Techniques & Tools
Rails Application Optimization Techniques & Tools
 
gRPC - RPC rebirth?
gRPC - RPC rebirth?gRPC - RPC rebirth?
gRPC - RPC rebirth?
 
Fighting Spam With A Perimeter Mail System 20071108 Sasag
Fighting Spam With A Perimeter Mail System 20071108 SasagFighting Spam With A Perimeter Mail System 20071108 Sasag
Fighting Spam With A Perimeter Mail System 20071108 Sasag
 
[233] level 2 network programming using packet ngin rtos
[233] level 2 network programming using packet ngin rtos[233] level 2 network programming using packet ngin rtos
[233] level 2 network programming using packet ngin rtos
 
Peter Zaitsev "18 ways to fix MySQL bottlenecks"
Peter Zaitsev "18 ways to fix MySQL bottlenecks"Peter Zaitsev "18 ways to fix MySQL bottlenecks"
Peter Zaitsev "18 ways to fix MySQL bottlenecks"
 
Robert Kubis - gRPC - boilerplate to high-performance scalable APIs - code.t...
 Robert Kubis - gRPC - boilerplate to high-performance scalable APIs - code.t... Robert Kubis - gRPC - boilerplate to high-performance scalable APIs - code.t...
Robert Kubis - gRPC - boilerplate to high-performance scalable APIs - code.t...
 
Kafka Evaluation - High Throughout Message Queue
Kafka Evaluation - High Throughout Message QueueKafka Evaluation - High Throughout Message Queue
Kafka Evaluation - High Throughout Message Queue
 
.NET RDF APIS
.NET RDF APIS.NET RDF APIS
.NET RDF APIS
 
Galaxy CloudMan performance on AWS
Galaxy CloudMan performance on AWSGalaxy CloudMan performance on AWS
Galaxy CloudMan performance on AWS
 
Scaling PostgreSQL with Skytools
Scaling PostgreSQL with SkytoolsScaling PostgreSQL with Skytools
Scaling PostgreSQL with Skytools
 
rspamd-slides
rspamd-slidesrspamd-slides
rspamd-slides
 
[231] the simplicity of cluster apps with circuit
[231] the simplicity of cluster apps with circuit[231] the simplicity of cluster apps with circuit
[231] the simplicity of cluster apps with circuit
 
Microservices summit talk 1/31
Microservices summit talk   1/31Microservices summit talk   1/31
Microservices summit talk 1/31
 
Perl Dist::Surveyor 2011
Perl Dist::Surveyor 2011Perl Dist::Surveyor 2011
Perl Dist::Surveyor 2011
 
Thanos - Prometheus on Scale
Thanos - Prometheus on ScaleThanos - Prometheus on Scale
Thanos - Prometheus on Scale
 
Performance
PerformancePerformance
Performance
 
Golang Performance : microbenchmarks, profilers, and a war story
Golang Performance : microbenchmarks, profilers, and a war storyGolang Performance : microbenchmarks, profilers, and a war story
Golang Performance : microbenchmarks, profilers, and a war story
 

Similar to Three Ruby usages

Network Traffic Search using Apache HBase
Network Traffic Search using Apache HBaseNetwork Traffic Search using Apache HBase
Network Traffic Search using Apache HBaseEvans Ye
 
"Introducing Distributed Tracing in a Large Software System", Kostiantyn Sha...
"Introducing Distributed Tracing in a Large Software System",  Kostiantyn Sha..."Introducing Distributed Tracing in a Large Software System",  Kostiantyn Sha...
"Introducing Distributed Tracing in a Large Software System", Kostiantyn Sha...Fwdays
 
[2C1] 아파치 피그를 위한 테즈 연산 엔진 개발하기 최종
[2C1] 아파치 피그를 위한 테즈 연산 엔진 개발하기 최종[2C1] 아파치 피그를 위한 테즈 연산 엔진 개발하기 최종
[2C1] 아파치 피그를 위한 테즈 연산 엔진 개발하기 최종NAVER D2
 
NocInformatyka2022.pdf
NocInformatyka2022.pdfNocInformatyka2022.pdf
NocInformatyka2022.pdfAdam Przybyła
 
PostgreSQL: present and near future
PostgreSQL: present and near futurePostgreSQL: present and near future
PostgreSQL: present and near futureNaN-tic
 
202107 - Orion introduction - COSCUP
202107 - Orion introduction - COSCUP202107 - Orion introduction - COSCUP
202107 - Orion introduction - COSCUPRonald Hsu
 
Extending Solr: Building a Cloud-like Knowledge Discovery Platform
Extending Solr: Building a Cloud-like Knowledge Discovery PlatformExtending Solr: Building a Cloud-like Knowledge Discovery Platform
Extending Solr: Building a Cloud-like Knowledge Discovery PlatformLucidworks (Archived)
 
Extending Solr: Behind CareerBuilder’s Cloud-like Knowledge Discovery Platfor...
Extending Solr: Behind CareerBuilder’s Cloud-like Knowledge Discovery Platfor...Extending Solr: Behind CareerBuilder’s Cloud-like Knowledge Discovery Platfor...
Extending Solr: Behind CareerBuilder’s Cloud-like Knowledge Discovery Platfor...lucenerevolution
 
Extending Solr: Building a Cloud-like Knowledge Discovery Platform
Extending Solr: Building a Cloud-like Knowledge Discovery PlatformExtending Solr: Building a Cloud-like Knowledge Discovery Platform
Extending Solr: Building a Cloud-like Knowledge Discovery PlatformTrey Grainger
 
Google File Systems
Google File SystemsGoogle File Systems
Google File SystemsAzeem Mumtaz
 
Distributed and concurrent programming with RabbitMQ and EventMachine Rails U...
Distributed and concurrent programming with RabbitMQ and EventMachine Rails U...Distributed and concurrent programming with RabbitMQ and EventMachine Rails U...
Distributed and concurrent programming with RabbitMQ and EventMachine Rails U...Paolo Negri
 
Taking Splunk to the Next Level - Architecture Breakout Session
Taking Splunk to the Next Level - Architecture Breakout SessionTaking Splunk to the Next Level - Architecture Breakout Session
Taking Splunk to the Next Level - Architecture Breakout SessionSplunk
 
Concurrent Programming with Ruby and Tuple Spaces
Concurrent Programming with Ruby and Tuple SpacesConcurrent Programming with Ruby and Tuple Spaces
Concurrent Programming with Ruby and Tuple Spacesluccastera
 
Parallelizing CI using Docker Swarm-Mode
Parallelizing CI using Docker Swarm-ModeParallelizing CI using Docker Swarm-Mode
Parallelizing CI using Docker Swarm-ModeAkihiro Suda
 
Cómo se diseña una base de datos que pueda ingerir más de cuatro millones de ...
Cómo se diseña una base de datos que pueda ingerir más de cuatro millones de ...Cómo se diseña una base de datos que pueda ingerir más de cuatro millones de ...
Cómo se diseña una base de datos que pueda ingerir más de cuatro millones de ...javier ramirez
 

Similar to Three Ruby usages (20)

Network Traffic Search using Apache HBase
Network Traffic Search using Apache HBaseNetwork Traffic Search using Apache HBase
Network Traffic Search using Apache HBase
 
"Introducing Distributed Tracing in a Large Software System", Kostiantyn Sha...
"Introducing Distributed Tracing in a Large Software System",  Kostiantyn Sha..."Introducing Distributed Tracing in a Large Software System",  Kostiantyn Sha...
"Introducing Distributed Tracing in a Large Software System", Kostiantyn Sha...
 
[2C1] 아파치 피그를 위한 테즈 연산 엔진 개발하기 최종
[2C1] 아파치 피그를 위한 테즈 연산 엔진 개발하기 최종[2C1] 아파치 피그를 위한 테즈 연산 엔진 개발하기 최종
[2C1] 아파치 피그를 위한 테즈 연산 엔진 개발하기 최종
 
NocInformatyka2022.pdf
NocInformatyka2022.pdfNocInformatyka2022.pdf
NocInformatyka2022.pdf
 
Web Scraping Basics
Web Scraping BasicsWeb Scraping Basics
Web Scraping Basics
 
Google File System
Google File SystemGoogle File System
Google File System
 
PostgreSQL: present and near future
PostgreSQL: present and near futurePostgreSQL: present and near future
PostgreSQL: present and near future
 
202107 - Orion introduction - COSCUP
202107 - Orion introduction - COSCUP202107 - Orion introduction - COSCUP
202107 - Orion introduction - COSCUP
 
Jan 2012 HUG: Storm
Jan 2012 HUG: StormJan 2012 HUG: Storm
Jan 2012 HUG: Storm
 
Extending Solr: Building a Cloud-like Knowledge Discovery Platform
Extending Solr: Building a Cloud-like Knowledge Discovery PlatformExtending Solr: Building a Cloud-like Knowledge Discovery Platform
Extending Solr: Building a Cloud-like Knowledge Discovery Platform
 
Extending Solr: Behind CareerBuilder’s Cloud-like Knowledge Discovery Platfor...
Extending Solr: Behind CareerBuilder’s Cloud-like Knowledge Discovery Platfor...Extending Solr: Behind CareerBuilder’s Cloud-like Knowledge Discovery Platfor...
Extending Solr: Behind CareerBuilder’s Cloud-like Knowledge Discovery Platfor...
 
Extending Solr: Building a Cloud-like Knowledge Discovery Platform
Extending Solr: Building a Cloud-like Knowledge Discovery PlatformExtending Solr: Building a Cloud-like Knowledge Discovery Platform
Extending Solr: Building a Cloud-like Knowledge Discovery Platform
 
Google File Systems
Google File SystemsGoogle File Systems
Google File Systems
 
reBuy on Kubernetes
reBuy on KubernetesreBuy on Kubernetes
reBuy on Kubernetes
 
Distributed and concurrent programming with RabbitMQ and EventMachine Rails U...
Distributed and concurrent programming with RabbitMQ and EventMachine Rails U...Distributed and concurrent programming with RabbitMQ and EventMachine Rails U...
Distributed and concurrent programming with RabbitMQ and EventMachine Rails U...
 
Taking Splunk to the Next Level - Architecture Breakout Session
Taking Splunk to the Next Level - Architecture Breakout SessionTaking Splunk to the Next Level - Architecture Breakout Session
Taking Splunk to the Next Level - Architecture Breakout Session
 
Concurrent Programming with Ruby and Tuple Spaces
Concurrent Programming with Ruby and Tuple SpacesConcurrent Programming with Ruby and Tuple Spaces
Concurrent Programming with Ruby and Tuple Spaces
 
Parallelizing CI using Docker Swarm-Mode
Parallelizing CI using Docker Swarm-ModeParallelizing CI using Docker Swarm-Mode
Parallelizing CI using Docker Swarm-Mode
 
Full stack development
Full stack developmentFull stack development
Full stack development
 
Cómo se diseña una base de datos que pueda ingerir más de cuatro millones de ...
Cómo se diseña una base de datos que pueda ingerir más de cuatro millones de ...Cómo se diseña una base de datos que pueda ingerir más de cuatro millones de ...
Cómo se diseña una base de datos que pueda ingerir más de cuatro millones de ...
 

More from Kouhei Sutou

RubyKaigi 2022 - Fast data processing with Ruby and Apache Arrow
RubyKaigi 2022 - Fast data processing with Ruby and Apache ArrowRubyKaigi 2022 - Fast data processing with Ruby and Apache Arrow
RubyKaigi 2022 - Fast data processing with Ruby and Apache ArrowKouhei Sutou
 
Apache Arrow Flight – ビッグデータ用高速データ転送フレームワーク #dbts2021
Apache Arrow Flight – ビッグデータ用高速データ転送フレームワーク #dbts2021Apache Arrow Flight – ビッグデータ用高速データ転送フレームワーク #dbts2021
Apache Arrow Flight – ビッグデータ用高速データ転送フレームワーク #dbts2021Kouhei Sutou
 
RubyKaigi Takeout 2021 - Red Arrow - Ruby and Apache Arrow
RubyKaigi Takeout 2021 - Red Arrow - Ruby and Apache ArrowRubyKaigi Takeout 2021 - Red Arrow - Ruby and Apache Arrow
RubyKaigi Takeout 2021 - Red Arrow - Ruby and Apache ArrowKouhei Sutou
 
Rubyと仕事と自由なソフトウェア
Rubyと仕事と自由なソフトウェアRubyと仕事と自由なソフトウェア
Rubyと仕事と自由なソフトウェアKouhei Sutou
 
Apache Arrowフォーマットはなぜ速いのか
Apache Arrowフォーマットはなぜ速いのかApache Arrowフォーマットはなぜ速いのか
Apache Arrowフォーマットはなぜ速いのかKouhei Sutou
 
Apache Arrow 1.0 - A cross-language development platform for in-memory data
Apache Arrow 1.0 - A cross-language development platform for in-memory dataApache Arrow 1.0 - A cross-language development platform for in-memory data
Apache Arrow 1.0 - A cross-language development platform for in-memory dataKouhei Sutou
 
Redmine検索の未来像
Redmine検索の未来像Redmine検索の未来像
Redmine検索の未来像Kouhei Sutou
 
Apache Arrow - A cross-language development platform for in-memory data
Apache Arrow - A cross-language development platform for in-memory dataApache Arrow - A cross-language development platform for in-memory data
Apache Arrow - A cross-language development platform for in-memory dataKouhei Sutou
 
Better CSV processing with Ruby 2.6
Better CSV processing with Ruby 2.6Better CSV processing with Ruby 2.6
Better CSV processing with Ruby 2.6Kouhei Sutou
 
Apache Arrow - データ処理ツールの次世代プラットフォーム
Apache Arrow - データ処理ツールの次世代プラットフォームApache Arrow - データ処理ツールの次世代プラットフォーム
Apache Arrow - データ処理ツールの次世代プラットフォームKouhei Sutou
 
MySQL・PostgreSQLだけで作る高速あいまい全文検索システム
MySQL・PostgreSQLだけで作る高速あいまい全文検索システムMySQL・PostgreSQLだけで作る高速あいまい全文検索システム
MySQL・PostgreSQLだけで作る高速あいまい全文検索システムKouhei Sutou
 
MySQL 8.0でMroonga
MySQL 8.0でMroongaMySQL 8.0でMroonga
MySQL 8.0でMroongaKouhei Sutou
 
Mroongaの高速全文検索機能でWordPress内のコンテンツを有効活用!
Mroongaの高速全文検索機能でWordPress内のコンテンツを有効活用!Mroongaの高速全文検索機能でWordPress内のコンテンツを有効活用!
Mroongaの高速全文検索機能でWordPress内のコンテンツを有効活用!Kouhei Sutou
 
MariaDBとMroongaで作る全言語対応超高速全文検索システム
MariaDBとMroongaで作る全言語対応超高速全文検索システムMariaDBとMroongaで作る全言語対応超高速全文検索システム
MariaDBとMroongaで作る全言語対応超高速全文検索システムKouhei Sutou
 
PGroonga 2 – Make PostgreSQL rich full text search system backend!
PGroonga 2 – Make PostgreSQL rich full text search system backend!PGroonga 2 – Make PostgreSQL rich full text search system backend!
PGroonga 2 – Make PostgreSQL rich full text search system backend!Kouhei Sutou
 

More from Kouhei Sutou (20)

RubyKaigi 2022 - Fast data processing with Ruby and Apache Arrow
RubyKaigi 2022 - Fast data processing with Ruby and Apache ArrowRubyKaigi 2022 - Fast data processing with Ruby and Apache Arrow
RubyKaigi 2022 - Fast data processing with Ruby and Apache Arrow
 
Apache Arrow Flight – ビッグデータ用高速データ転送フレームワーク #dbts2021
Apache Arrow Flight – ビッグデータ用高速データ転送フレームワーク #dbts2021Apache Arrow Flight – ビッグデータ用高速データ転送フレームワーク #dbts2021
Apache Arrow Flight – ビッグデータ用高速データ転送フレームワーク #dbts2021
 
RubyKaigi Takeout 2021 - Red Arrow - Ruby and Apache Arrow
RubyKaigi Takeout 2021 - Red Arrow - Ruby and Apache ArrowRubyKaigi Takeout 2021 - Red Arrow - Ruby and Apache Arrow
RubyKaigi Takeout 2021 - Red Arrow - Ruby and Apache Arrow
 
Rubyと仕事と自由なソフトウェア
Rubyと仕事と自由なソフトウェアRubyと仕事と自由なソフトウェア
Rubyと仕事と自由なソフトウェア
 
Apache Arrowフォーマットはなぜ速いのか
Apache Arrowフォーマットはなぜ速いのかApache Arrowフォーマットはなぜ速いのか
Apache Arrowフォーマットはなぜ速いのか
 
Apache Arrow 1.0 - A cross-language development platform for in-memory data
Apache Arrow 1.0 - A cross-language development platform for in-memory dataApache Arrow 1.0 - A cross-language development platform for in-memory data
Apache Arrow 1.0 - A cross-language development platform for in-memory data
 
Apache Arrow 2019
Apache Arrow 2019Apache Arrow 2019
Apache Arrow 2019
 
Redmine検索の未来像
Redmine検索の未来像Redmine検索の未来像
Redmine検索の未来像
 
Apache Arrow - A cross-language development platform for in-memory data
Apache Arrow - A cross-language development platform for in-memory dataApache Arrow - A cross-language development platform for in-memory data
Apache Arrow - A cross-language development platform for in-memory data
 
Better CSV processing with Ruby 2.6
Better CSV processing with Ruby 2.6Better CSV processing with Ruby 2.6
Better CSV processing with Ruby 2.6
 
Apache Arrow
Apache ArrowApache Arrow
Apache Arrow
 
Apache Arrow - データ処理ツールの次世代プラットフォーム
Apache Arrow - データ処理ツールの次世代プラットフォームApache Arrow - データ処理ツールの次世代プラットフォーム
Apache Arrow - データ処理ツールの次世代プラットフォーム
 
Apache Arrow
Apache ArrowApache Arrow
Apache Arrow
 
MySQL・PostgreSQLだけで作る高速あいまい全文検索システム
MySQL・PostgreSQLだけで作る高速あいまい全文検索システムMySQL・PostgreSQLだけで作る高速あいまい全文検索システム
MySQL・PostgreSQLだけで作る高速あいまい全文検索システム
 
MySQL 8.0でMroonga
MySQL 8.0でMroongaMySQL 8.0でMroonga
MySQL 8.0でMroonga
 
My way with Ruby
My way with RubyMy way with Ruby
My way with Ruby
 
Red Data Tools
Red Data ToolsRed Data Tools
Red Data Tools
 
Mroongaの高速全文検索機能でWordPress内のコンテンツを有効活用!
Mroongaの高速全文検索機能でWordPress内のコンテンツを有効活用!Mroongaの高速全文検索機能でWordPress内のコンテンツを有効活用!
Mroongaの高速全文検索機能でWordPress内のコンテンツを有効活用!
 
MariaDBとMroongaで作る全言語対応超高速全文検索システム
MariaDBとMroongaで作る全言語対応超高速全文検索システムMariaDBとMroongaで作る全言語対応超高速全文検索システム
MariaDBとMroongaで作る全言語対応超高速全文検索システム
 
PGroonga 2 – Make PostgreSQL rich full text search system backend!
PGroonga 2 – Make PostgreSQL rich full text search system backend!PGroonga 2 – Make PostgreSQL rich full text search system backend!
PGroonga 2 – Make PostgreSQL rich full text search system backend!
 

Recently uploaded

Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 

Recently uploaded (20)

Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 

Three Ruby usages

  • 1. Three Ruby usages Kouhei Sutou ClearCode Inc. RubyKaigi 2014 2014/09/20 Three Ruby usages Powered by Rabbit 2.1.4
  • 2. Silver sponsor Three Ruby usages Powered by Rabbit 2.1.4
  • 3. Goal You know three Ruby usages ✓High-level interface ✓Glue ✓Embed ✓ ✓You can remember them later Three Ruby usages Powered by Rabbit 2.1.4
  • 4. Targets High-level interface ✓Pure Rubyists ✓ Glue ✓Rubyists who can write C/C++ ✓ Embed ✓Rubyists who also write C/C++ ✓ Three Ruby usages Powered by Rabbit 2.1.4
  • 5. Case study Implement distributed full-text search engine in Ruby Abbreviation: DFTSE = Distributed Full-Text Search Engine Three Ruby usages Powered by Rabbit 2.1.4
  • 6. DFTSE? Distrubuted Full- Text Search Engine Full- Text Search Engine 1: Full-text search 2: Distribute sub requests 3: Merge responses Three Ruby usages Powered by Rabbit 2.1.4
  • 7. Why do we use DFTSE? I'm developing Droonga (A DFTSE implementation in Ruby)  Three Ruby usages Powered by Rabbit 2.1.4
  • 8. High-level interface Three Ruby usages High-level interface Target: ✓ Pure Rubyists ✓ ✓Glue ✓Embed Three Ruby usages Powered by Rabbit 2.1.4
  • 9. High-level interface Provides lower layer feature to higher layer ✓ With simpler/✓ convenience API Three Ruby usages Powered by Rabbit 2.1.4
  • 10. High-level interface Higher layer users High-level interface Feature by Yukihiro Matsumoto Application/Library Three Ruby usages Powered by Rabbit 2.1.4
  • 11. Example Vagrant Active Record Developers Vagrantfile Build development environment Vagrant b y Y u k i h i r o M a t s u m o t o Developers Object based API b y Y u k i h i r o M a t s u m o t o Access data in RDBMS Active Record Three Ruby usages Powered by Rabbit 2.1.4
  • 12. Droonga: High-level IF DFTSE components Full-✓ text search engine ✓Messaging system ✓Cluster management ✓Process management Three Ruby usages Powered by Rabbit 2.1.4
  • 13. Messaging system 1: Full-text search DTFSE FTSE 2: Distribute sub requests 3: Merge responses Worker process Messaging system Three Ruby usages Powered by Rabbit 2.1.4
  • 14. Messaging system Provides distributed search feature ✓Plan how to search ✓Distribute requests ✓Merge responses ✓ ✓Users don't know details Three Ruby usages Powered by Rabbit 2.1.4
  • 15. Characteristic Plan how to search May speed up/✓ down over 100 times ✓ Distribute requests ✓Network bound operation ✓ Merge responses ✓CPU and network bound operation ✓ Three Ruby usages Powered by Rabbit 2.1.4
  • 16. Point Algorithm is important Need to find new/existing better algorithm ✓ "Rapid prototype and measure" feedback loop is helpful ✓ Ruby is ✓ good at rapid dev. ✓ Three Ruby usages Powered by Rabbit 2.1.4
  • 17. Glue Three Ruby usages ✓High-level interface Glue Target: Rubyists who can write C/C++ ✓ ✓ ✓Embed Three Ruby usages Powered by Rabbit 2.1.4
  • 18. Glue Export a feature Feature Combine features Glue Ruby Other Language Three Ruby usages Powered by Rabbit 2.1.4
  • 19. Example mysql2 gem Vagrant Access to MySQL VM Provision libmysqlclient.so (VirtualBox) (Chef) Feature Active Record Glue Three Ruby usages Powered by Rabbit 2.1.4
  • 20. Why do we glue? Reuse ✓ existing features Three Ruby usages Powered by Rabbit 2.1.4
  • 21. How to glue Use external library Implement ✓ bindings (mysql2 gem) ✓ Use external command ✓Spawn command (Vagrant) ✓ Use external service ✓Implement client ✓ Three Ruby usages Powered by Rabbit 2.1.4
  • 22. Glue in Droonga Rroonga: Groonga bindings Groonga: ✓ FTSE C library (and server) ✓ Cool.io: libev bindings libev: Event loop C library (Based on I/O multiplexing and non-blocking I/O) ✓ ✓ ✓Serf: Clustering tool (in Droonga) Three Ruby usages Powered by Rabbit 2.1.4
  • 23. Rroonga in Droonga 1: Full-text search DTFSE FTSE 2: Distribute sub requests 3: Merge responses Worker process Messaging system Three Ruby usages Powered by Rabbit 2.1.4
  • 24. FTSE in Droonga ✓Must be fast! ✓CPU bound processing Three Ruby usages Powered by Rabbit 2.1.4
  • 25. For fast Rroonga Do heavy processing in C Nice to ✓ have Ruby-ish API ✓ Less memory allocation ✓Cache internal buffer ✓ Multiprocessing ✓Groonga supports multiprocessing ✓ Three Ruby usages Powered by Rabbit 2.1.4
  • 26. Search Groonga::Database.open(ARGV[0]) entries = Groonga["Entries"] entries.select do |record| record.description =~ "Ruby" end Three Ruby usages Powered by Rabbit 2.1.4
  • 27. Search - Pure Ruby (ref) Groonga::Database.open(ARGV[0]) entries = Groonga["Entries"] entries.find_all do |record| # This block is evaluated for each record /Ruby/ =~ record.description end Three Ruby usages Powered by Rabbit 2.1.4
  • 28. Search impl. # (2) Evaluate expression in C entries.select do |record| # (1) Build expression in Ruby # This block is evaluated only once record.description =~ "Ruby" end Three Ruby usages Powered by Rabbit 2.1.4
  • 29. Search impl. - Fig. Ruby by Groonga project C entries.select do |record| record.description =~ "Ruby" end Build Search request Expression Result set Evaluate expression by Groonga project Three Ruby usages Powered by Rabbit 2.1.4
  • 30. Search - Benchmark ✓Ruby (It's already showed) ✓C Three Ruby usages Powered by Rabbit 2.1.4
  • 31. Search - C grn_obj *expr; grn_obj *variable; const gchar *filter = "description @ "Ruby""; grn_obj *result; GRN_EXPR_CREATE_FOR_QUERY(&ctx, table, expr, variable); grn_expr_parse(&ctx, expr, filter, strlen(filter), NULL, GRN_OP_MATCH, GRN_OP_AND, GRN_EXPR_SYNTAX_SCRIPT); result = grn_table_select(&ctx, table, expr, NULL, GRN_OP_OR); grn_obj_unlink(&ctx, expr); grn_obj_unlink(&ctx, result); Three Ruby usages Powered by Rabbit 2.1.4
  • 32. Search - Benchmark Ruby impl. is fast enough  Impl. Elapsed time C 0.6ms Ruby 0.8ms (Full-text search with "Ruby" against 72632 records) Three Ruby usages Powered by Rabbit 2.1.4
  • 33. Embed Three Ruby usages ✓High-level interface ✓Glue Embed Target: Rubyists who also write C/C++ ✓ ✓ Three Ruby usages Powered by Rabbit 2.1.4
  • 34. Embed Internal engine Interface C/C++ application C/C++ library Implement some features in Ruby Plugin API Conifugration by Yukihiro Matsumoto by Yukihiro Matsumoto C/C++ application C/C++ library Three Ruby usages Powered by Rabbit 2.1.4
  • 35. Examples Internal engine Interface Implement query optimizer in Ruby vim-ruby by Yukihiro Matsumoto by Yukihiro Matsumoto VIM Three Ruby usages Powered by Rabbit 2.1.4
  • 36. Embed in Droonga by Yukihiro Matsumoto by Yukihiro Matsumoto ... by The Groonga Project by The Groonga Project by The Groonga Project mruby by Yukihiro Matsumoto Three Ruby usages Powered by Rabbit 2.1.4
  • 37. CRuby vs. mruby CRuby ✓Full featured! ✓Signal handler isn't needed  ✓ mruby ✓Multi-interpreters in a process! ✓You may miss some features  ✓ Three Ruby usages Powered by Rabbit 2.1.4
  • 38. mruby in Groonga ✓Query optimizer Command interface (plan) ✓Interface and also high-level interface! ✓ Plugin API (plan) ✓Interface! ✓ Three Ruby usages Powered by Rabbit 2.1.4
  • 39. Query optimizer Query Optimize Optimized Query Optimizer query Full-text search Evaluator by Yukihiro Matsumoto Result set Three Ruby usages Powered by Rabbit 2.1.4
  • 40. Query optimizer Plan how to search ✓It's a bother  ✓ ✓Light operation than FTS Depends on data (Choose effective index, use table scan and so on) ✓ Three Ruby usages Powered by Rabbit 2.1.4
  • 41. Example rank < 200 && rank > 100 Three Ruby usages Powered by Rabbit 2.1.4
  • 42. Simple impl. rank 1 2 ... 100 ... 200 ... ... 10000 rank > 100 rank < 200 101 199 && 101 ... 199 rank < 200 && rank > 100 Three Ruby usages Powered by Rabbit 2.1.4
  • 43. Simple impl. Slow against many out of range data ✓ Three Ruby usages Powered by Rabbit 2.1.4
  • 44. Optimized impl. rank 1 2 ... 100 101 ... 199 200 ... ... 10000 100 < rank < 200 101 ... 199 rank < 200 && rank > 100 Three Ruby usages Powered by Rabbit 2.1.4
  • 45. Is embedding reasonable? Measure Three Ruby usages Powered by Rabbit 2.1.4
  • 46. Measure ✓mruby overhead ✓Speed-up by optimization Three Ruby usages Powered by Rabbit 2.1.4
  • 47. Overhead Small overhead: Reasonable # conds mruby Elapsed 1 ○ 0.24ms 1 × 0.16ms 4 ○ 0.45ms 4 × 0.19ms Three Ruby usages Powered by Rabbit 2.1.4
  • 48. Speed-up Fast for many data:Reasonable # records mruby no mruby 1000 0.29ms 0.31ms 10000 0.31ms 2.3ms 100000 0.26ms 21.1ms 1000000 0.26ms 210.2ms Three Ruby usages Powered by Rabbit 2.1.4
  • 49. Note Embedding needs many works Write bindings, import mruby your build system and ... ✓ ✓ How to test your mruby part? ✓And how to debug? ✓ Three Ruby usages Powered by Rabbit 2.1.4
  • 51. Conclusion 1 Describe three Ruby usages ✓High-level interface ✓Glue ✓Embed ✓ Three Ruby usages Powered by Rabbit 2.1.4
  • 52. Conclusion 2 High-level interface ✓ Target: Pure Rubyists ✓ Provides lower layer feature to higher layer w/ usable interface ✓Ruby's flexibility is useful ✓ Three Ruby usages Powered by Rabbit 2.1.4
  • 53. Conclusion 3 Glue Target: Rubyists who can write C/C++ ✓ Why: Reuse ✓ existing feature ✓To be fast, do the process in C ✓ Three Ruby usages Powered by Rabbit 2.1.4
  • 54. Conclusion 4 Embed Target: Rubyists who also write C/C++ ✓ Why: Avoid bother programming by Ruby ✓ ✓ Three Ruby usages Powered by Rabbit 2.1.4
  • 55. Conclusion 5 Embed Is it reasonable ✓ for your case? ✓You need many works ✓ Very powerful if your case is reasonable ✓ Three Ruby usages Powered by Rabbit 2.1.4
  • 56. Announcement ClearCode Inc. ✓A silver sponsor ✓Is recruiting ✓Will do readable code workshop ✓ The next Groonga conference ✓It's held at 11/29 ✓ Three Ruby usages Powered by Rabbit 2.1.4