SlideShare une entreprise Scribd logo
1  sur  9
Why Jruby
By Chris Ochs
Background
• Social games built using rails
• Needed to integrate with existing java libraries
• Deployment with mongrel was starting to hurt
• First jruby/rails based game did ≈300,000,000 requests per day
• Generated over a billion requests per day to nosql database
• Non standard rails 3.0 app. No Activerecord. Json views
Concurrency Concurrency Concurrency
• Concurrency is 90% why to use jruby
• Ruby GIL effectively means peak cpu utilization 1.5 – 2 cores
• No atomics in ruby, no work on lock free algorithms
• Ruby thread primitives are not enough. Don’t use them in jruby
• Java.util.concurrent makes threading easy (and performant)
• Really good debugging/performance/stress testing tools available in
java
What kind of concurrency to expect
• Using ruby primitives limits you. Using mutex/synchronize you will
cap out very quickly and see a lot of threads blocking.
• With java.util.concurrent up to hundreds of threads before blocking
becomes an issue.
• Real world apps will usually eat up all cpu/io before hitting context
switching due to lots of threads.
• Real world non trivial rails app handled 750 requests per second using
80 threads.
Ruby world is still not thread safe
• Lots of gems are not thread safe. Usually a jruby specific alternative.
• Rails *might* be thread safe by 4.0
• Many misunderstandings around thread safety of system level calls
• Several layers of IO buffering can happen
• Hard learned lesson from java. If the vm doesn’t make any
guarantees, assume it’s not thread safe
• Things are steadily improving. Rails of all places is leading the way
(but still has a ways to go)
Effective use of jruby
• Lots of jruby gems that are thin wrappers around java libraries
• Loading random java library and calling from jruby usually just works
• Many places where the java library is better designed.
• Leverage what java does better, but avoid writing java
• Learn to use java.util.concurrent
• Learn to use thread & heap dumps
• Stay away from rails for now
Must use tools
• Thread & heap dumps changed my life. Makes debugging
performance and memory related issues easy
• Visualvm is your friend. Works remotely. Connect to any running
server to get memory stats, thread dumps, etc..
• You can instrument apps with JMX to get real time
performance/memory info. Or you can get at it directly in jruby and
log via regular logs.
Java libraries I like
• Netty.io. The java version of eventmachine
• Spymemcached. Because Dalli has a giant mutex around network
calls
• Rjack. Collections of jruby wrappers for common java libraries
• Java logging. Rjack SLF4J + Logback my favorite
• Akka. Actor framework for concurrency
• Guard-jruby-rspec. Makes rspec about as fast as under Cruby
• Apache camel
Rants
• Ruby (rails mostly) community spread a lot of bad information
• Many of us simply didn’t know better, so we bought into it
• Processes are not better then threads.
• Thread safe code is not hard if you have the right tools
• Please stop making ruby code thread safe by wrapping everything in a
mutex. If you can’t write a proper thread pool, use Thread.local
instead. I don’t care if you think it’s ugly, at least it’s usable.

Contenu connexe

Tendances

Nashorn: JavaScript that doesn’t suck (ILJUG)
Nashorn: JavaScript that doesn’t suck (ILJUG)Nashorn: JavaScript that doesn’t suck (ILJUG)
Nashorn: JavaScript that doesn’t suck (ILJUG)Tomer Gabel
 
Tampering with JavaScript
Tampering with JavaScriptTampering with JavaScript
Tampering with JavaScriptBoy Baukema
 
How to Keep Your Data Safe in MongoDB
How to Keep Your Data Safe in MongoDBHow to Keep Your Data Safe in MongoDB
How to Keep Your Data Safe in MongoDBMongoDB
 
Introduction to NodeJS
Introduction to NodeJSIntroduction to NodeJS
Introduction to NodeJSZahid Mahir
 
Actors Set the Stage for Project Orleans
Actors Set the Stage for Project OrleansActors Set the Stage for Project Orleans
Actors Set the Stage for Project Orleanscjmyers
 
Conquering AngularJS Limitations
Conquering AngularJS LimitationsConquering AngularJS Limitations
Conquering AngularJS LimitationsValeri Karpov
 
Building a production ready meteor app
Building a production ready meteor appBuilding a production ready meteor app
Building a production ready meteor appRitik Malhotra
 
Scaling a MeteorJS SaaS app on AWS
Scaling a MeteorJS SaaS app on AWSScaling a MeteorJS SaaS app on AWS
Scaling a MeteorJS SaaS app on AWSBrett McLain
 
Put Your Thinking CAP On
Put Your Thinking CAP OnPut Your Thinking CAP On
Put Your Thinking CAP OnTomer Gabel
 
An introduction to node3
An introduction to node3An introduction to node3
An introduction to node3Vivian S. Zhang
 
Horizontally Scaling Node.js and WebSockets
Horizontally Scaling Node.js and WebSocketsHorizontally Scaling Node.js and WebSockets
Horizontally Scaling Node.js and WebSocketsJames Simpson
 
Xen_and_Rails_deployment
Xen_and_Rails_deploymentXen_and_Rails_deployment
Xen_and_Rails_deploymentAbhishek Singh
 
PHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web DevelopmentPHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web DevelopmentIrfan Maulana
 
Introduction to Django-Celery and Supervisor
Introduction to Django-Celery and SupervisorIntroduction to Django-Celery and Supervisor
Introduction to Django-Celery and SupervisorSuresh Kumar
 

Tendances (15)

Nashorn: JavaScript that doesn’t suck (ILJUG)
Nashorn: JavaScript that doesn’t suck (ILJUG)Nashorn: JavaScript that doesn’t suck (ILJUG)
Nashorn: JavaScript that doesn’t suck (ILJUG)
 
Tampering with JavaScript
Tampering with JavaScriptTampering with JavaScript
Tampering with JavaScript
 
How to Keep Your Data Safe in MongoDB
How to Keep Your Data Safe in MongoDBHow to Keep Your Data Safe in MongoDB
How to Keep Your Data Safe in MongoDB
 
Ruby on the JVM
Ruby on the JVMRuby on the JVM
Ruby on the JVM
 
Introduction to NodeJS
Introduction to NodeJSIntroduction to NodeJS
Introduction to NodeJS
 
Actors Set the Stage for Project Orleans
Actors Set the Stage for Project OrleansActors Set the Stage for Project Orleans
Actors Set the Stage for Project Orleans
 
Conquering AngularJS Limitations
Conquering AngularJS LimitationsConquering AngularJS Limitations
Conquering AngularJS Limitations
 
Building a production ready meteor app
Building a production ready meteor appBuilding a production ready meteor app
Building a production ready meteor app
 
Scaling a MeteorJS SaaS app on AWS
Scaling a MeteorJS SaaS app on AWSScaling a MeteorJS SaaS app on AWS
Scaling a MeteorJS SaaS app on AWS
 
Put Your Thinking CAP On
Put Your Thinking CAP OnPut Your Thinking CAP On
Put Your Thinking CAP On
 
An introduction to node3
An introduction to node3An introduction to node3
An introduction to node3
 
Horizontally Scaling Node.js and WebSockets
Horizontally Scaling Node.js and WebSocketsHorizontally Scaling Node.js and WebSockets
Horizontally Scaling Node.js and WebSockets
 
Xen_and_Rails_deployment
Xen_and_Rails_deploymentXen_and_Rails_deployment
Xen_and_Rails_deployment
 
PHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web DevelopmentPHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web Development
 
Introduction to Django-Celery and Supervisor
Introduction to Django-Celery and SupervisorIntroduction to Django-Celery and Supervisor
Introduction to Django-Celery and Supervisor
 

En vedette

Дистанционное обучение коучингу
Дистанционное обучение коучингуДистанционное обучение коучингу
Дистанционное обучение коучингуZina Jensen-Maar
 
Presentazione dimasi generale
Presentazione dimasi  generalePresentazione dimasi  generale
Presentazione dimasi generaleDimasi_Software
 
как найти миссию своей жизни
как найти миссию своей жизникак найти миссию своей жизни
как найти миссию своей жизниZina Jensen-Maar
 
Software Automotive DMS Software
Software Automotive DMS SoftwareSoftware Automotive DMS Software
Software Automotive DMS SoftwareDimasi_Software
 
коучинг- тренинг «Возьми жизнь в свои руки»
коучинг- тренинг «Возьми жизнь в свои руки»коучинг- тренинг «Возьми жизнь в свои руки»
коучинг- тренинг «Возьми жизнь в свои руки»Zina Jensen-Maar
 
Глубинная работа с образами в коучинге
Глубинная работа с образами в коучингеГлубинная работа с образами в коучинге
Глубинная работа с образами в коучингеZina Jensen-Maar
 
Дистанционное обучение коучингу
Дистанционное обучение коучингуДистанционное обучение коучингу
Дистанционное обучение коучингуZina Jensen-Maar
 
Que quiere decir ser un buen profesional de la educacion para el siglo
Que quiere decir ser un buen profesional de la educacion para el sigloQue quiere decir ser un buen profesional de la educacion para el siglo
Que quiere decir ser un buen profesional de la educacion para el sigloKevo Young
 
Actividaddeaprendizaje08
Actividaddeaprendizaje08Actividaddeaprendizaje08
Actividaddeaprendizaje08Kevo Young
 
Pengenalan analisis data dan statistika
Pengenalan analisis data dan statistikaPengenalan analisis data dan statistika
Pengenalan analisis data dan statistikaannatriyana
 
Quick sort and binary search PDF
Quick sort and binary search PDFQuick sort and binary search PDF
Quick sort and binary search PDFDivya modi
 
Etika tik, uu hak cipta dan k3
Etika tik, uu hak cipta dan k3Etika tik, uu hak cipta dan k3
Etika tik, uu hak cipta dan k3Ery Bureni
 
spring–mass system
spring–mass systemspring–mass system
spring–mass systemDivya modi
 
National income(Engineering Economics and Management-EEM)
National income(Engineering Economics and Management-EEM)National income(Engineering Economics and Management-EEM)
National income(Engineering Economics and Management-EEM)Divya modi
 

En vedette (15)

Дистанционное обучение коучингу
Дистанционное обучение коучингуДистанционное обучение коучингу
Дистанционное обучение коучингу
 
Presentazione dimasi generale
Presentazione dimasi  generalePresentazione dimasi  generale
Presentazione dimasi generale
 
как найти миссию своей жизни
как найти миссию своей жизникак найти миссию своей жизни
как найти миссию своей жизни
 
Software Automotive DMS Software
Software Automotive DMS SoftwareSoftware Automotive DMS Software
Software Automotive DMS Software
 
коучинг- тренинг «Возьми жизнь в свои руки»
коучинг- тренинг «Возьми жизнь в свои руки»коучинг- тренинг «Возьми жизнь в свои руки»
коучинг- тренинг «Возьми жизнь в свои руки»
 
Глубинная работа с образами в коучинге
Глубинная работа с образами в коучингеГлубинная работа с образами в коучинге
Глубинная работа с образами в коучинге
 
Дистанционное обучение коучингу
Дистанционное обучение коучингуДистанционное обучение коучингу
Дистанционное обучение коучингу
 
Que quiere decir ser un buen profesional de la educacion para el siglo
Que quiere decir ser un buen profesional de la educacion para el sigloQue quiere decir ser un buen profesional de la educacion para el siglo
Que quiere decir ser un buen profesional de la educacion para el siglo
 
Actividaddeaprendizaje08
Actividaddeaprendizaje08Actividaddeaprendizaje08
Actividaddeaprendizaje08
 
Ashish handicrafts-enterprises
Ashish handicrafts-enterprisesAshish handicrafts-enterprises
Ashish handicrafts-enterprises
 
Pengenalan analisis data dan statistika
Pengenalan analisis data dan statistikaPengenalan analisis data dan statistika
Pengenalan analisis data dan statistika
 
Quick sort and binary search PDF
Quick sort and binary search PDFQuick sort and binary search PDF
Quick sort and binary search PDF
 
Etika tik, uu hak cipta dan k3
Etika tik, uu hak cipta dan k3Etika tik, uu hak cipta dan k3
Etika tik, uu hak cipta dan k3
 
spring–mass system
spring–mass systemspring–mass system
spring–mass system
 
National income(Engineering Economics and Management-EEM)
National income(Engineering Economics and Management-EEM)National income(Engineering Economics and Management-EEM)
National income(Engineering Economics and Management-EEM)
 

Similaire à Seattlerb why jruby

Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Newlink
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Newlink
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640LLC NewLink
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Newlink
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Newlink
 
Ruby Concurrency Realities
Ruby Concurrency RealitiesRuby Concurrency Realities
Ruby Concurrency RealitiesMike Subelsky
 
Modern Java Concurrency (OSCON 2012)
Modern Java Concurrency (OSCON 2012)Modern Java Concurrency (OSCON 2012)
Modern Java Concurrency (OSCON 2012)Martijn Verburg
 
Introduction to JRuby
Introduction to JRubyIntroduction to JRuby
Introduction to JRubyajuckel
 
Bringing Concurrency to Ruby - RubyConf India 2014
Bringing Concurrency to Ruby - RubyConf India 2014Bringing Concurrency to Ruby - RubyConf India 2014
Bringing Concurrency to Ruby - RubyConf India 2014Charles Nutter
 
Hybrid concurrency patterns
Hybrid concurrency patternsHybrid concurrency patterns
Hybrid concurrency patternsKyle Drake
 
Actors and Threads
Actors and ThreadsActors and Threads
Actors and Threadsmperham
 
Migrating to Java 11
Migrating to Java 11Migrating to Java 11
Migrating to Java 11Arto Santala
 
Java in High Frequency Trading
Java in High Frequency TradingJava in High Frequency Trading
Java in High Frequency TradingViktor Sovietov
 
JRuby - The Best of Java and Ruby
JRuby - The Best of Java and RubyJRuby - The Best of Java and Ruby
JRuby - The Best of Java and RubyEvgeny Rahman
 
Full stack development using javascript what and why - ajay chandravadiya
Full stack development using javascript   what and why - ajay chandravadiyaFull stack development using javascript   what and why - ajay chandravadiya
Full stack development using javascript what and why - ajay chandravadiyaajayrcgmail
 
Concurrency in java
Concurrency in javaConcurrency in java
Concurrency in javaAbhra Basak
 
U4 JAVA.pptx
U4 JAVA.pptxU4 JAVA.pptx
U4 JAVA.pptxmadan r
 

Similaire à Seattlerb why jruby (20)

Why Play Framework is fast
Why Play Framework is fastWhy Play Framework is fast
Why Play Framework is fast
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640
 
Ruby Concurrency Realities
Ruby Concurrency RealitiesRuby Concurrency Realities
Ruby Concurrency Realities
 
Modern Java Concurrency (OSCON 2012)
Modern Java Concurrency (OSCON 2012)Modern Java Concurrency (OSCON 2012)
Modern Java Concurrency (OSCON 2012)
 
Introduction to JRuby
Introduction to JRubyIntroduction to JRuby
Introduction to JRuby
 
Bringing Concurrency to Ruby - RubyConf India 2014
Bringing Concurrency to Ruby - RubyConf India 2014Bringing Concurrency to Ruby - RubyConf India 2014
Bringing Concurrency to Ruby - RubyConf India 2014
 
Hybrid concurrency patterns
Hybrid concurrency patternsHybrid concurrency patterns
Hybrid concurrency patterns
 
Day 8 - jRuby
Day 8 - jRubyDay 8 - jRuby
Day 8 - jRuby
 
Actors and Threads
Actors and ThreadsActors and Threads
Actors and Threads
 
Migrating to Java 11
Migrating to Java 11Migrating to Java 11
Migrating to Java 11
 
Node.js primer
Node.js primerNode.js primer
Node.js primer
 
Java in High Frequency Trading
Java in High Frequency TradingJava in High Frequency Trading
Java in High Frequency Trading
 
JRuby - The Best of Java and Ruby
JRuby - The Best of Java and RubyJRuby - The Best of Java and Ruby
JRuby - The Best of Java and Ruby
 
Full stack development using javascript what and why - ajay chandravadiya
Full stack development using javascript   what and why - ajay chandravadiyaFull stack development using javascript   what and why - ajay chandravadiya
Full stack development using javascript what and why - ajay chandravadiya
 
Concurrency in java
Concurrency in javaConcurrency in java
Concurrency in java
 
U4 JAVA.pptx
U4 JAVA.pptxU4 JAVA.pptx
U4 JAVA.pptx
 

Dernier

Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 

Dernier (20)

Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 

Seattlerb why jruby

  • 2. Background • Social games built using rails • Needed to integrate with existing java libraries • Deployment with mongrel was starting to hurt • First jruby/rails based game did ≈300,000,000 requests per day • Generated over a billion requests per day to nosql database • Non standard rails 3.0 app. No Activerecord. Json views
  • 3. Concurrency Concurrency Concurrency • Concurrency is 90% why to use jruby • Ruby GIL effectively means peak cpu utilization 1.5 – 2 cores • No atomics in ruby, no work on lock free algorithms • Ruby thread primitives are not enough. Don’t use them in jruby • Java.util.concurrent makes threading easy (and performant) • Really good debugging/performance/stress testing tools available in java
  • 4. What kind of concurrency to expect • Using ruby primitives limits you. Using mutex/synchronize you will cap out very quickly and see a lot of threads blocking. • With java.util.concurrent up to hundreds of threads before blocking becomes an issue. • Real world apps will usually eat up all cpu/io before hitting context switching due to lots of threads. • Real world non trivial rails app handled 750 requests per second using 80 threads.
  • 5. Ruby world is still not thread safe • Lots of gems are not thread safe. Usually a jruby specific alternative. • Rails *might* be thread safe by 4.0 • Many misunderstandings around thread safety of system level calls • Several layers of IO buffering can happen • Hard learned lesson from java. If the vm doesn’t make any guarantees, assume it’s not thread safe • Things are steadily improving. Rails of all places is leading the way (but still has a ways to go)
  • 6. Effective use of jruby • Lots of jruby gems that are thin wrappers around java libraries • Loading random java library and calling from jruby usually just works • Many places where the java library is better designed. • Leverage what java does better, but avoid writing java • Learn to use java.util.concurrent • Learn to use thread & heap dumps • Stay away from rails for now
  • 7. Must use tools • Thread & heap dumps changed my life. Makes debugging performance and memory related issues easy • Visualvm is your friend. Works remotely. Connect to any running server to get memory stats, thread dumps, etc.. • You can instrument apps with JMX to get real time performance/memory info. Or you can get at it directly in jruby and log via regular logs.
  • 8. Java libraries I like • Netty.io. The java version of eventmachine • Spymemcached. Because Dalli has a giant mutex around network calls • Rjack. Collections of jruby wrappers for common java libraries • Java logging. Rjack SLF4J + Logback my favorite • Akka. Actor framework for concurrency • Guard-jruby-rspec. Makes rspec about as fast as under Cruby • Apache camel
  • 9. Rants • Ruby (rails mostly) community spread a lot of bad information • Many of us simply didn’t know better, so we bought into it • Processes are not better then threads. • Thread safe code is not hard if you have the right tools • Please stop making ruby code thread safe by wrapping everything in a mutex. If you can’t write a proper thread pool, use Thread.local instead. I don’t care if you think it’s ugly, at least it’s usable.