SlideShare a Scribd company logo
Performance Tuning on Go 2.0http://www.thoughtworks-studios.com/go/Yogi Kulkarni
GoContinuous integration Release management
Perfomance tuning on Go 2.0
PipelineStage-2Unit TestStage-3Acceptance TestStage-1CompileRun Unit Test Suite - 1Accetance Test Suite - 1CompileJobRun Unit Test Suite - 2Acceptance Test Suite – 2Run Unit Test Suite - 3
Pipeline Dashboard
Perfomance tuning on Go 2.0
Pipeline Dependencies
The Problem
Slow page loads
Jobs taking long to get assigned to agents
Jobs getting rescheduled
Artifact uploads timing out
Server VM freezing
Lots of concurrent activity
What was happening under the hood?Profiler revealed the culprits
Thread blocks
Threads blocked on the database connection pool
So we introduced asynchronicity
Big mistake!
Find the root cause
Perfomance tuning on Go 2.0
Perfomance tuning on Go 2.0
Perfomance tuning on Go 2.0
ObjectiveNo request should take > 100 msMost should be under 50 ms
Setup & Tools
Conservative hardware
“Performance Server”Dell 620 laptop2 Cores, 2GB RAM
Large Dataset5GB merged databaseLarge config file with 100 pipelinesReal-world data
Extreme load70 agentsEach Job generating lots of console outputEach Job uploading 10 MB artifactsApache Bench / Httperf
Automation for fast feedbackCapistrano scriptFeedback cycle down from hours to 10 min
Caching
Single application-wide cacheDomain objectsDTOsRails view fragments
Perfomance tuning on Go 2.0
EHCacheIn-memory onlyLeast-Recently-Used eviction policy
Transaction rollbacks == Incorrect cached dataIgnore cache puts in transactionsInvalidate caches on transaction commit only
Spring to the rescue
Fast deep-cloning of cached objectsJava Deep Cloning Library: http://robust-it.co.uk/clone/index.php
Locks
Be suspicious of synchronized methods
Lock on interned stringsFine granularityProfiler supportAlso used as cache keys
Perfomance tuning on Go 2.0
Use ReadWriteLocks for highly contended code
Use “volatile” fields for lockless reads
Slow
Not synchronized
Acquire locks before starting transactionsTo enforce aggregate invariants
Thread 1Stage(Building)Job – 1(Completed)Stage(Building)Stage(Building)Job – 2(Building)Job – 1(Completed)Job – 1(Building)Thread 2Job – 2(Cmpleted)Job – 2(Building)Stage(Building)Job – 1(Building)Job – 2(Completed)
Perfomance tuning on Go 2.0
Query Tuning
Use a large databaseUse the query analyzer to find missing indexes
Views are great… sometimes10x-20x faster for “TOP n” queriesDepends on database implementation
Query selectivity is important200 msPipelines(20,000 rows)Stages(70,000 rows)BuildStateTransitions(4,000,000 rows)
Introduce an n+1 query2 ms
JRuby on Rails Hacks
Single JRuby runtime +  Rails multi-threaded mode Much lower memory footprintBut completely uncharted territory
Severe thread blocks in JRubyReported to JRuby communityFixed immediately in 1.5.0 &  1.5.1
Rails nested partials Mysterious lock contention10 concurrent requests take 90 secs to completeStill a mystery!
Desperate situations, desperate measuresStatically inline partials at build time!
Routes subsystem is slowCache url_for
LoggingReplace Rails BufferedLogger with Java Log4jLoggerTurn off Rails logging in production
Fragment cachingGenerate a cache-key that incorprates all fields that are needed to uniquely identify that object’s current stateLRU cache will evict it on state change
“pipelineDashboardFragment|dev|2[compile,1,passed][test,1,building]”Pipeline-nameStage detailStage detailKey-identifier
“pipelineDashboardFragment|dev|2[compile,1,passed][test,1,passed]”Pipeline-nameStage detailStage detailKey-identifier“pipelineDashboardFragment|dev|1[compile,1,passed][test,1,building]”
Lessons LearnedFind the root causeUse a profilerMeasure before and after each fix
How we got from that to thisINSERT IMAGEThreads after performance tuning
http://www.thoughtworks-studios.com/go/

More Related Content

What's hot (20)

PPTX
RedisConf17 - Too Big to Failover - A cautionary tale of scaling Redis
Redis Labs
 
PDF
Developer-friendly taskqueues: What you should ask yourself before choosing one
Sylvain Zimmer
 
PPTX
Kafka Summit NYC 2017 - Deep Dive Into Apache Kafka
confluent
 
PDF
Asynchronous job queues with python-rq
Ashish Acharya
 
PDF
Apache Kafka – (Pattern and) Anti-Pattern
confluent
 
PDF
Performance Tuning - Understanding Garbage Collection
Haribabu Nandyal Padmanaban
 
PDF
Introduction to tempest
openstackindia
 
PDF
Performance optimization 101 - Erlang Factory SF 2014
lpgauth
 
PDF
SwarmKit in Theory and Practice
Laura Frank Tacho
 
PPTX
No data loss pipeline with apache kafka
Jiangjie Qin
 
PPTX
Distributed Tests on Pulsar with Fallout - Pulsar Summit NA 2021
StreamNative
 
PDF
CCI2018 - Benchmarking in the cloud
walk2talk srl
 
PDF
Extreme HTTP Performance Tuning: 1.2M API req/s on a 4 vCPU EC2 Instance
ScyllaDB
 
PPTX
Streaming and Messaging
Xin Wang
 
PDF
How to tune Kafka® for production
confluent
 
PDF
Redis acl
DaeMyung Kang
 
PDF
Fault Tolerance and Job Recovery in Apache Flink @ FlinkForward 2015
Till Rohrmann
 
PPTX
When it Absolutely, Positively, Has to be There: Reliability Guarantees in Ka...
confluent
 
PPTX
Transition to high-speed WORDPRESS using KUSANAGI
Sumito Tsukada
 
PDF
Power of the Log: LSM & Append Only Data Structures
confluent
 
RedisConf17 - Too Big to Failover - A cautionary tale of scaling Redis
Redis Labs
 
Developer-friendly taskqueues: What you should ask yourself before choosing one
Sylvain Zimmer
 
Kafka Summit NYC 2017 - Deep Dive Into Apache Kafka
confluent
 
Asynchronous job queues with python-rq
Ashish Acharya
 
Apache Kafka – (Pattern and) Anti-Pattern
confluent
 
Performance Tuning - Understanding Garbage Collection
Haribabu Nandyal Padmanaban
 
Introduction to tempest
openstackindia
 
Performance optimization 101 - Erlang Factory SF 2014
lpgauth
 
SwarmKit in Theory and Practice
Laura Frank Tacho
 
No data loss pipeline with apache kafka
Jiangjie Qin
 
Distributed Tests on Pulsar with Fallout - Pulsar Summit NA 2021
StreamNative
 
CCI2018 - Benchmarking in the cloud
walk2talk srl
 
Extreme HTTP Performance Tuning: 1.2M API req/s on a 4 vCPU EC2 Instance
ScyllaDB
 
Streaming and Messaging
Xin Wang
 
How to tune Kafka® for production
confluent
 
Redis acl
DaeMyung Kang
 
Fault Tolerance and Job Recovery in Apache Flink @ FlinkForward 2015
Till Rohrmann
 
When it Absolutely, Positively, Has to be There: Reliability Guarantees in Ka...
confluent
 
Transition to high-speed WORDPRESS using KUSANAGI
Sumito Tsukada
 
Power of the Log: LSM & Append Only Data Structures
confluent
 

Viewers also liked (13)

PPTX
Scatter-Gather
Francesca Della Corte
 
PPTX
Performance tuning in mule
Son Nguyen
 
PPTX
Mule ESB Intro
Noga Manela
 
ODP
Mule flow processing strategies
D.Rajesh Kumar
 
PPT
Mule exception strategies - Catch exception strategy
Ankush Sharma
 
PPTX
Request in mule
Son Nguyen
 
PPTX
Basic example using vm component
prudhvivreddy
 
PDF
Application Architecture: The Next Wave | MuleSoft
Bui Kiet
 
PPTX
Controlling Message Flow - Mule ESB
Mani Rathnam Gudi
 
PPTX
Elements in a mule flow
Sindhu VL
 
PPTX
Mule ESB Tutorial Part 2
Srikanth N
 
PPT
Mule ESB
niravn
 
PDF
Future of Integration | MuleSoft
MuleSoft
 
Scatter-Gather
Francesca Della Corte
 
Performance tuning in mule
Son Nguyen
 
Mule ESB Intro
Noga Manela
 
Mule flow processing strategies
D.Rajesh Kumar
 
Mule exception strategies - Catch exception strategy
Ankush Sharma
 
Request in mule
Son Nguyen
 
Basic example using vm component
prudhvivreddy
 
Application Architecture: The Next Wave | MuleSoft
Bui Kiet
 
Controlling Message Flow - Mule ESB
Mani Rathnam Gudi
 
Elements in a mule flow
Sindhu VL
 
Mule ESB Tutorial Part 2
Srikanth N
 
Mule ESB
niravn
 
Future of Integration | MuleSoft
MuleSoft
 
Ad

Similar to Perfomance tuning on Go 2.0 (20)

KEY
Rails performance at Justin.tv - Guillaume Luccisano
Guillaume Luccisano
 
PPTX
Performance & Scalability Improvements in Perforce
Perforce
 
PDF
Rails Application Optimization Techniques & Tools
guest05c09d
 
PDF
Rails App performance at the limit - Bogdan Gusiev
Ruby Meditation
 
PPTX
Day 7 - Make it Fast
Barry Jones
 
PDF
Wiktor Schmidt, RuPy 2008, Caching in Rails
Netguru
 
PPT
Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...
John McCaffrey
 
PPT
Windy cityrails performance_tuning
John McCaffrey
 
DOCX
Rails Concept
Javed Hussain
 
KEY
Synchronous Reads Asynchronous Writes RubyConf 2009
pauldix
 
PPTX
Ruby/Rails Performance Tips
PatrickMcSweeny
 
PDF
Performance on Rails
Pedro Sousa
 
PDF
Rubyconf presentation
krevuri
 
PPTX
Boosting the Performance of your Rails Apps
Matt Kuklinski
 
PPTX
RedisConf17 - Redfin - The Real Estate Brokerage and the In-memory Database
Redis Labs
 
PPT
How To Scale v2
Georgio_1999
 
KEY
Rapid development with Rails
Yi-Ting Cheng
 
KEY
Away day
Ivayr Farah Netto
 
PPT
How to scale your web app
Georgio_1999
 
ODP
DiUS Computing Lca Rails Final
Robert Postill
 
Rails performance at Justin.tv - Guillaume Luccisano
Guillaume Luccisano
 
Performance & Scalability Improvements in Perforce
Perforce
 
Rails Application Optimization Techniques & Tools
guest05c09d
 
Rails App performance at the limit - Bogdan Gusiev
Ruby Meditation
 
Day 7 - Make it Fast
Barry Jones
 
Wiktor Schmidt, RuPy 2008, Caching in Rails
Netguru
 
Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...
John McCaffrey
 
Windy cityrails performance_tuning
John McCaffrey
 
Rails Concept
Javed Hussain
 
Synchronous Reads Asynchronous Writes RubyConf 2009
pauldix
 
Ruby/Rails Performance Tips
PatrickMcSweeny
 
Performance on Rails
Pedro Sousa
 
Rubyconf presentation
krevuri
 
Boosting the Performance of your Rails Apps
Matt Kuklinski
 
RedisConf17 - Redfin - The Real Estate Brokerage and the In-memory Database
Redis Labs
 
How To Scale v2
Georgio_1999
 
Rapid development with Rails
Yi-Ting Cheng
 
How to scale your web app
Georgio_1999
 
DiUS Computing Lca Rails Final
Robert Postill
 
Ad

Recently uploaded (20)

PDF
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
PDF
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
PDF
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
PDF
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
PDF
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
PPTX
AI Code Generation Risks (Ramkumar Dilli, CIO, Myridius)
Priyanka Aash
 
PDF
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
PPTX
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
PPTX
Agentic AI in Healthcare Driving the Next Wave of Digital Transformation
danielle hunter
 
PPTX
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PDF
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
PDF
RAT Builders - How to Catch Them All [DeepSec 2024]
malmoeb
 
PDF
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
PDF
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
PPTX
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
PPTX
The Future of AI & Machine Learning.pptx
pritsen4700
 
PDF
TrustArc Webinar - Navigating Data Privacy in LATAM: Laws, Trends, and Compli...
TrustArc
 
PPTX
AVL ( audio, visuals or led ), technology.
Rajeshwri Panchal
 
PDF
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
AI Code Generation Risks (Ramkumar Dilli, CIO, Myridius)
Priyanka Aash
 
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
Agentic AI in Healthcare Driving the Next Wave of Digital Transformation
danielle hunter
 
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
RAT Builders - How to Catch Them All [DeepSec 2024]
malmoeb
 
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
The Future of AI & Machine Learning.pptx
pritsen4700
 
TrustArc Webinar - Navigating Data Privacy in LATAM: Laws, Trends, and Compli...
TrustArc
 
AVL ( audio, visuals or led ), technology.
Rajeshwri Panchal
 
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 

Perfomance tuning on Go 2.0

Editor's Notes

  • #2: Top 5 points
  • #19: Just pushed the bottleneck to the other end of the queueIncreased complexity
  • #47: Otherwise last thread winsVersion field with retries
  • #57: Very responsive community
  • #58: SHOW STOPPER