SlideShare ist ein Scribd-Unternehmen logo
1 von 28
Downloaden Sie, um offline zu lesen
Tales of ISUCON5
and Its Bench Tools
BizReach internal meetup (Nov 27, 2015)
Satoshi "Moris" Tagomori (@tagomoris)
Satoshi "Moris" Tagomori
(@tagomoris)
Fluentd, Norikra, Hadoop,
MessagePack-Ruby, Woothee, ...
Treasure Data, Inc.
http://www.treasuredata.com/
HQ
Branch
ISUCON5 Main Topics
• Qualify: "ISUxi"
• Good old SNS
• Friend relations, Footprint, Many N+1 queries, ...
• Final: "AirISU"
• API aggregate server
• Parallel requests, Application processes/threads,
Cache based on data/protocol, HTTP/2, ...
How to Get High Score
in ISUCON5
• Qualify
• Add index, Cache master data, Remove N+1, ...
• Final
• Massive threads, Cache invariable data, Async/
Parallel requests to APIs, If-Modied-Since,
HTTP/2, ...
BUG
Bugs in Organizer Side
• Qualify
• Nothing serious
• Last bug was fixed at 1st day 11:30am
• Final
• Some serious bugs in scenario to make effects
for top N players
Benchmark Tool
Why ISUCON Bench Tools
Should Be Written Newly?
• Two inconsistent requirements:
• high performance
• integrity check
• 1 request pattern for 2 requirements
• players can cheat w/ different requests for
purposes
Requirements in detail
• Performance
• throughput, concurrency, low latency
• Content check
• HTML parser, JSON parser, CSS/JS check, Image, other binaries, ...
• Complex scenario coding
• tools should simulate user behavior
• Protocol handling in detail
• HTTP protocols, HTTP headers, keepalive, cache control, timeouts, ...
• Variable source data
• disable "cache all requests/response" strategy
Features
• Sending GET/POST requests
• w/ various query params a/o content body
• w/ various HTTP headers
• Sending request series for a session
• Sending request series for several sessions
• Checking response integrity/consistency
• Skipping response check for performance if needed
Rough Sketch
• http_load + custom ruby script
• http_load: requests for performance
• ruby script: requests for checks
Sessions!
(http_load cannot handle sessions)
Overview
• Java: jetty-client + Java8 Lambda
• jetty-client for performance
• lambda for content check
• jackson to parse input data
• jsoup to parse response html (CSS selector)
• json-path to parse response json (JsonPath)
{
getAndCheck(session, "/", "GET INDEX BEFORE SIGNUP", (check) -> { check.isRedirect("/login"); });
getAndCheck(session, "/login", "GET LOGIN BEFORE SIGNUP", (check) -> {
check.isStatus(200);
check.isContentType("text/html");
if (! check.hasViolations()) {
check.exist("form.form-signin[action=/login]");
check.exist("input[name=email]");
check.exist("input[name=password]");
check.exist("button[type=submit]");
check.hasStyleSheet("/css/bootstrap.min.css");
check.hasStyleSheet("/css/signin.css");
}
});
getAndCheck(session, "/css/bootstrap.min.css", "BOOTSTRAP CSS", (check) -> {
check.isStatus(200);
if (! check.hasViolations()) {
check.isContentBodyChecksum("08df9a96752852f2cbd310c30facd934e348c2c5");
}
});
getAndCheck(session, "/css/signin.css", "SIGNIN CSS", (check) -> {
check.isStatus(200);
if (! check.hasViolations()) {
check.isContentBodyChecksum("702783cc5eff3d8d3532e339ddd15c57f7a08776");
}
});
}
Bootstrap.java
while (true) {
if (LocalDateTime.now().isAfter(stopAt))
break;
Session s = sessions.get(random.nextInt((int) sessions.size()));
get(s, "/login");
get(s, "/css/bootstrap.min.css");
get(s, "/css/signin.css");
post(s, "/login", formLogin(s));
if (LocalDateTime.now().isAfter(stopAt))
break;
get(s, "/");
get(s, "/css/bootstrap.min.css");
get(s, "/css/jumbotron-narrow.css");
get(s, "/js/jquery-1.11.3.js");
get(s, "/js/bootstrap.js");
get(s, "/js/airisu.js");
get(s, "/user.js");
if (LocalDateTime.now().isAfter(stopAt))
break;
for (int i = 0 ; i < 10 ; i++) {
get(s, "/data");
if (LocalDateTime.now().isAfter(stopAt))
break;
}
if (LocalDateTime.now().isAfter(stopAt))
break;
}
Load.java
@Override
public Result finishHook(Result result) {
long requests = result.requests;
if (result.responses.exception * 100.0 / (requests * 1.0) >= 1.0) {
result.addViolation("Too many exceptions", "通信エラー等の失敗が多過ぎます(1%以上)");
result.fail();
}
if (result.responses.error * 100.0 / (requests * 1.0) >= 1.0) {
result.addViolation("Too many errors", "ステータス 5xx のレスポンスが多過ぎます(1%以上)");
result.fail();
}
if (result.responses.failure * 100.0 / (requests * 1.0) >= 5.0) {
result.addViolation("Too many failures", "ステータス 4xx のレスポンスが多過ぎます(5%以上)");
result.fail();
}
return result;
}
@Override
public Step[] steps() {
Step[] steps = new Step[3];
steps[0] = new Step(35000L, Init.class);
steps[1] = new Step(60000L, Bootstrap.class);
steps[2] = new Step(
70000L,
Checker.class, ModifyLoader.class,
Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class,
Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class,
Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class,
Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class,
Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class,
Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class
);
return steps;
} Full.java
Code Example
• Simple scenario
• https://github.com/isucon/isucon5-final/blob/master/bench/src/main/java/net/isucon/
isucon5f/bench/Load.java
• https://github.com/isucon/isucon5-final/blob/master/bench/src/main/java/net/isucon/
isucon5f/bench/Checker.java
• https://github.com/isucon/isucon5-final/blob/master/bench/src/main/java/net/isucon/
isucon5f/bench/Bootstrap.java
• https://github.com/isucon/isucon5-final/blob/master/bench/src/main/java/net/isucon/
isucon5f/bench/Init.java
• Complex scenario
• https://github.com/isucon/isucon5-final/blob/master/bench/src/main/java/net/isucon/
isucon5f/bench/Full.java
Distributed Benchmarking
• N nodes for 1 benchmark
• Can a node perform fast enough? (CPU bounded)
• Y -> 1 vs 1, N -> 2 vs 1
• "GET /": 5000req/thread on localhost -> enough
• N nodes for many benchmarks
• Scale out strategy
• Queue/worker system
Scaling out nodes
ISUCON Portal (RoR)
Queue (MySQL)
Daemon script (ruby)
Bench (Java)
Daemon script (ruby)
Daemon script (ruby)
Daemon script (ruby)
Bench (Java)
ack req/set result
Daemon script (ruby)
Bench (Java)
Recorded Performance
• about 194,000 requests / 60 sec
• OK: 185,000
• Redirects: 9,300
• Peak 30 nodes (Qualify)
• 11,500 benchmarks in 2days
Far more: Scenario
• Checking for critical issues / non-critical issues
• Critical/non-critical mode of Checker class
• Checks w/ dependencies
• If a check fails, following checks throws NPE :(
Some More Topics
• Async
• Gigantic parallel requests
• 2 or more simultaneous requests under control
Java8: What and How I feel
about it
OSS: net.isucon.bench.*

Weitere ähnliche Inhalte

Was ist angesagt?

Modernizing Infrastructures for Fast Data with Spark, Kafka, Cassandra, React...
Modernizing Infrastructures for Fast Data with Spark, Kafka, Cassandra, React...Modernizing Infrastructures for Fast Data with Spark, Kafka, Cassandra, React...
Modernizing Infrastructures for Fast Data with Spark, Kafka, Cassandra, React...
Lightbend
 
Natural Language Query and Conversational Interface to Apache Spark
Natural Language Query and Conversational Interface to Apache SparkNatural Language Query and Conversational Interface to Apache Spark
Natural Language Query and Conversational Interface to Apache Spark
Databricks
 

Was ist angesagt? (20)

Apache Sparkにおけるメモリ - アプリケーションを落とさないメモリ設計手法 -
Apache Sparkにおけるメモリ - アプリケーションを落とさないメモリ設計手法 -Apache Sparkにおけるメモリ - アプリケーションを落とさないメモリ設計手法 -
Apache Sparkにおけるメモリ - アプリケーションを落とさないメモリ設計手法 -
 
Logging for Production Systems in The Container Era
Logging for Production Systems in The Container EraLogging for Production Systems in The Container Era
Logging for Production Systems in The Container Era
 
RESTful API – How to Consume, Extract, Store and Visualize Data with InfluxDB...
RESTful API – How to Consume, Extract, Store and Visualize Data with InfluxDB...RESTful API – How to Consume, Extract, Store and Visualize Data with InfluxDB...
RESTful API – How to Consume, Extract, Store and Visualize Data with InfluxDB...
 
Open Source Software, Distributed Systems, Database as a Cloud Service
Open Source Software, Distributed Systems, Database as a Cloud ServiceOpen Source Software, Distributed Systems, Database as a Cloud Service
Open Source Software, Distributed Systems, Database as a Cloud Service
 
Fluentd - Flexible, Stable, Scalable
Fluentd - Flexible, Stable, ScalableFluentd - Flexible, Stable, Scalable
Fluentd - Flexible, Stable, Scalable
 
Empowering developers to deploy their own data stores
Empowering developers to deploy their own data storesEmpowering developers to deploy their own data stores
Empowering developers to deploy their own data stores
 
Handling not so big data
Handling not so big dataHandling not so big data
Handling not so big data
 
Logstash
LogstashLogstash
Logstash
 
Norikra Recent Updates
Norikra Recent UpdatesNorikra Recent Updates
Norikra Recent Updates
 
DOD 2016 - Rafał Kuć - Building a Resilient Log Aggregation Pipeline Using El...
DOD 2016 - Rafał Kuć - Building a Resilient Log Aggregation Pipeline Using El...DOD 2016 - Rafał Kuć - Building a Resilient Log Aggregation Pipeline Using El...
DOD 2016 - Rafał Kuć - Building a Resilient Log Aggregation Pipeline Using El...
 
To scale or not to scale: Key/Value, Document, SQL, JPA – What’s right for my...
To scale or not to scale: Key/Value, Document, SQL, JPA – What’s right for my...To scale or not to scale: Key/Value, Document, SQL, JPA – What’s right for my...
To scale or not to scale: Key/Value, Document, SQL, JPA – What’s right for my...
 
Introduction to ELK
Introduction to ELKIntroduction to ELK
Introduction to ELK
 
Toronto High Scalability meetup - Scaling ELK
Toronto High Scalability meetup - Scaling ELKToronto High Scalability meetup - Scaling ELK
Toronto High Scalability meetup - Scaling ELK
 
Loading 350M documents into a large Solr cluster: Presented by Dion Olsthoorn...
Loading 350M documents into a large Solr cluster: Presented by Dion Olsthoorn...Loading 350M documents into a large Solr cluster: Presented by Dion Olsthoorn...
Loading 350M documents into a large Solr cluster: Presented by Dion Olsthoorn...
 
Airbnb Search Architecture: Presented by Maxim Charkov, Airbnb
Airbnb Search Architecture: Presented by Maxim Charkov, AirbnbAirbnb Search Architecture: Presented by Maxim Charkov, Airbnb
Airbnb Search Architecture: Presented by Maxim Charkov, Airbnb
 
ELK Stack
ELK StackELK Stack
ELK Stack
 
Modernizing Infrastructures for Fast Data with Spark, Kafka, Cassandra, React...
Modernizing Infrastructures for Fast Data with Spark, Kafka, Cassandra, React...Modernizing Infrastructures for Fast Data with Spark, Kafka, Cassandra, React...
Modernizing Infrastructures for Fast Data with Spark, Kafka, Cassandra, React...
 
Natural Language Query and Conversational Interface to Apache Spark
Natural Language Query and Conversational Interface to Apache SparkNatural Language Query and Conversational Interface to Apache Spark
Natural Language Query and Conversational Interface to Apache Spark
 
ELK introduction
ELK introductionELK introduction
ELK introduction
 
Streaming process with Kafka Connect and Kafka Streams
Streaming process with Kafka Connect and Kafka StreamsStreaming process with Kafka Connect and Kafka Streams
Streaming process with Kafka Connect and Kafka Streams
 

Ähnlich wie Tale of ISUCON and Its Bench Tools

Ajax tutorial
Ajax tutorialAjax tutorial
Ajax tutorial
Kat Roque
 
Introducing Amplify
Introducing AmplifyIntroducing Amplify
Introducing Amplify
appendTo
 
Synchronous Commands over Apache Kafka (Neil Buesing, Object Partners, Inc) K...
Synchronous Commands over Apache Kafka (Neil Buesing, Object Partners, Inc) K...Synchronous Commands over Apache Kafka (Neil Buesing, Object Partners, Inc) K...
Synchronous Commands over Apache Kafka (Neil Buesing, Object Partners, Inc) K...
confluent
 
Counters with Riak on Amazon EC2 at Hackover
Counters with Riak on Amazon EC2 at HackoverCounters with Riak on Amazon EC2 at Hackover
Counters with Riak on Amazon EC2 at Hackover
Andrei Savu
 

Ähnlich wie Tale of ISUCON and Its Bench Tools (20)

System insight without Interference
System insight without InterferenceSystem insight without Interference
System insight without Interference
 
Big data, just an introduction to Hadoop and Scripting Languages
Big data, just an introduction to Hadoop and Scripting LanguagesBig data, just an introduction to Hadoop and Scripting Languages
Big data, just an introduction to Hadoop and Scripting Languages
 
Nordic APIs - Automatic Testing of (RESTful) API Documentation
Nordic APIs - Automatic Testing of (RESTful) API DocumentationNordic APIs - Automatic Testing of (RESTful) API Documentation
Nordic APIs - Automatic Testing of (RESTful) API Documentation
 
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & MobileIVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
 
Crafting Evolvable Api Responses
Crafting Evolvable Api ResponsesCrafting Evolvable Api Responses
Crafting Evolvable Api Responses
 
API Days Paris - Automatic Testing of (RESTful) API Documentation
API Days Paris - Automatic Testing of (RESTful) API DocumentationAPI Days Paris - Automatic Testing of (RESTful) API Documentation
API Days Paris - Automatic Testing of (RESTful) API Documentation
 
Play Framework and Activator
Play Framework and ActivatorPlay Framework and Activator
Play Framework and Activator
 
Big data week presentation
Big data week presentationBig data week presentation
Big data week presentation
 
DjangoCon 2010 Scaling Disqus
DjangoCon 2010 Scaling DisqusDjangoCon 2010 Scaling Disqus
DjangoCon 2010 Scaling Disqus
 
Ajax tutorial
Ajax tutorialAjax tutorial
Ajax tutorial
 
Javascript Everywhere
Javascript EverywhereJavascript Everywhere
Javascript Everywhere
 
HTML5 Hacking - Yahoo! Open Hack Day
HTML5 Hacking - Yahoo! Open Hack DayHTML5 Hacking - Yahoo! Open Hack Day
HTML5 Hacking - Yahoo! Open Hack Day
 
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディングXitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
 
Xitrum @ Scala Matsuri Tokyo 2014
Xitrum @ Scala Matsuri Tokyo 2014Xitrum @ Scala Matsuri Tokyo 2014
Xitrum @ Scala Matsuri Tokyo 2014
 
JS Essence
JS EssenceJS Essence
JS Essence
 
Introducing Amplify
Introducing AmplifyIntroducing Amplify
Introducing Amplify
 
Spring data requery
Spring data requerySpring data requery
Spring data requery
 
Invoke-CradleCrafter: Moar PowerShell obFUsk8tion & Detection (@('Tech','niqu...
Invoke-CradleCrafter: Moar PowerShell obFUsk8tion & Detection (@('Tech','niqu...Invoke-CradleCrafter: Moar PowerShell obFUsk8tion & Detection (@('Tech','niqu...
Invoke-CradleCrafter: Moar PowerShell obFUsk8tion & Detection (@('Tech','niqu...
 
Synchronous Commands over Apache Kafka (Neil Buesing, Object Partners, Inc) K...
Synchronous Commands over Apache Kafka (Neil Buesing, Object Partners, Inc) K...Synchronous Commands over Apache Kafka (Neil Buesing, Object Partners, Inc) K...
Synchronous Commands over Apache Kafka (Neil Buesing, Object Partners, Inc) K...
 
Counters with Riak on Amazon EC2 at Hackover
Counters with Riak on Amazon EC2 at HackoverCounters with Riak on Amazon EC2 at Hackover
Counters with Riak on Amazon EC2 at Hackover
 

Mehr von SATOSHI TAGOMORI

Mehr von SATOSHI TAGOMORI (20)

Ractor's speed is not light-speed
Ractor's speed is not light-speedRactor's speed is not light-speed
Ractor's speed is not light-speed
 
Good Things and Hard Things of SaaS Development/Operations
Good Things and Hard Things of SaaS Development/OperationsGood Things and Hard Things of SaaS Development/Operations
Good Things and Hard Things of SaaS Development/Operations
 
Maccro Strikes Back
Maccro Strikes BackMaccro Strikes Back
Maccro Strikes Back
 
Invitation to the dark side of Ruby
Invitation to the dark side of RubyInvitation to the dark side of Ruby
Invitation to the dark side of Ruby
 
Hijacking Ruby Syntax in Ruby (RubyConf 2018)
Hijacking Ruby Syntax in Ruby (RubyConf 2018)Hijacking Ruby Syntax in Ruby (RubyConf 2018)
Hijacking Ruby Syntax in Ruby (RubyConf 2018)
 
Make Your Ruby Script Confusing
Make Your Ruby Script ConfusingMake Your Ruby Script Confusing
Make Your Ruby Script Confusing
 
Hijacking Ruby Syntax in Ruby
Hijacking Ruby Syntax in RubyHijacking Ruby Syntax in Ruby
Hijacking Ruby Syntax in Ruby
 
Lock, Concurrency and Throughput of Exclusive Operations
Lock, Concurrency and Throughput of Exclusive OperationsLock, Concurrency and Throughput of Exclusive Operations
Lock, Concurrency and Throughput of Exclusive Operations
 
Data Processing and Ruby in the World
Data Processing and Ruby in the WorldData Processing and Ruby in the World
Data Processing and Ruby in the World
 
Planet-scale Data Ingestion Pipeline: Bigdam
Planet-scale Data Ingestion Pipeline: BigdamPlanet-scale Data Ingestion Pipeline: Bigdam
Planet-scale Data Ingestion Pipeline: Bigdam
 
Technologies, Data Analytics Service and Enterprise Business
Technologies, Data Analytics Service and Enterprise BusinessTechnologies, Data Analytics Service and Enterprise Business
Technologies, Data Analytics Service and Enterprise Business
 
Ruby and Distributed Storage Systems
Ruby and Distributed Storage SystemsRuby and Distributed Storage Systems
Ruby and Distributed Storage Systems
 
Perfect Norikra 2nd Season
Perfect Norikra 2nd SeasonPerfect Norikra 2nd Season
Perfect Norikra 2nd Season
 
Fluentd 101
Fluentd 101Fluentd 101
Fluentd 101
 
To Have Own Data Analytics Platform, Or NOT To
To Have Own Data Analytics Platform, Or NOT ToTo Have Own Data Analytics Platform, Or NOT To
To Have Own Data Analytics Platform, Or NOT To
 
The Patterns of Distributed Logging and Containers
The Patterns of Distributed Logging and ContainersThe Patterns of Distributed Logging and Containers
The Patterns of Distributed Logging and Containers
 
How To Write Middleware In Ruby
How To Write Middleware In RubyHow To Write Middleware In Ruby
How To Write Middleware In Ruby
 
Modern Black Mages Fighting in the Real World
Modern Black Mages Fighting in the Real WorldModern Black Mages Fighting in the Real World
Modern Black Mages Fighting in the Real World
 
Fluentd Overview, Now and Then
Fluentd Overview, Now and ThenFluentd Overview, Now and Then
Fluentd Overview, Now and Then
 
Fighting API Compatibility On Fluentd Using "Black Magic"
Fighting API Compatibility On Fluentd Using "Black Magic"Fighting API Compatibility On Fluentd Using "Black Magic"
Fighting API Compatibility On Fluentd Using "Black Magic"
 

KĂźrzlich hochgeladen

CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

KĂźrzlich hochgeladen (20)

%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 

Tale of ISUCON and Its Bench Tools

  • 1. Tales of ISUCON5 and Its Bench Tools BizReach internal meetup (Nov 27, 2015) Satoshi "Moris" Tagomori (@tagomoris)
  • 2. Satoshi "Moris" Tagomori (@tagomoris) Fluentd, Norikra, Hadoop, MessagePack-Ruby, Woothee, ... Treasure Data, Inc.
  • 3.
  • 6.
  • 7. ISUCON5 Main Topics • Qualify: "ISUxi" • Good old SNS • Friend relations, Footprint, Many N+1 queries, ... • Final: "AirISU" • API aggregate server • Parallel requests, Application processes/threads, Cache based on data/protocol, HTTP/2, ...
  • 8. How to Get High Score in ISUCON5 • Qualify • Add index, Cache master data, Remove N+1, ... • Final • Massive threads, Cache invariable data, Async/ Parallel requests to APIs, If-Modied-Since, HTTP/2, ...
  • 9. BUG
  • 10. Bugs in Organizer Side • Qualify • Nothing serious • Last bug was xed at 1st day 11:30am • Final • Some serious bugs in scenario to make effects for top N players
  • 12. Why ISUCON Bench Tools Should Be Written Newly? • Two inconsistent requirements: • high performance • integrity check • 1 request pattern for 2 requirements • players can cheat w/ different requests for purposes
  • 13. Requirements in detail • Performance • throughput, concurrency, low latency • Content check • HTML parser, JSON parser, CSS/JS check, Image, other binaries, ... • Complex scenario coding • tools should simulate user behavior • Protocol handling in detail • HTTP protocols, HTTP headers, keepalive, cache control, timeouts, ... • Variable source data • disable "cache all requests/response" strategy
  • 14. Features • Sending GET/POST requests • w/ various query params a/o content body • w/ various HTTP headers • Sending request series for a session • Sending request series for several sessions • Checking response integrity/consistency • Skipping response check for performance if needed
  • 15. Rough Sketch • http_load + custom ruby script • http_load: requests for performance • ruby script: requests for checks
  • 17. Overview • Java: jetty-client + Java8 Lambda • jetty-client for performance • lambda for content check • jackson to parse input data • jsoup to parse response html (CSS selector) • json-path to parse response json (JsonPath)
  • 18. { getAndCheck(session, "/", "GET INDEX BEFORE SIGNUP", (check) -> { check.isRedirect("/login"); }); getAndCheck(session, "/login", "GET LOGIN BEFORE SIGNUP", (check) -> { check.isStatus(200); check.isContentType("text/html"); if (! check.hasViolations()) { check.exist("form.form-signin[action=/login]"); check.exist("input[name=email]"); check.exist("input[name=password]"); check.exist("button[type=submit]"); check.hasStyleSheet("/css/bootstrap.min.css"); check.hasStyleSheet("/css/signin.css"); } }); getAndCheck(session, "/css/bootstrap.min.css", "BOOTSTRAP CSS", (check) -> { check.isStatus(200); if (! check.hasViolations()) { check.isContentBodyChecksum("08df9a96752852f2cbd310c30facd934e348c2c5"); } }); getAndCheck(session, "/css/signin.css", "SIGNIN CSS", (check) -> { check.isStatus(200); if (! check.hasViolations()) { check.isContentBodyChecksum("702783cc5eff3d8d3532e339ddd15c57f7a08776"); } }); } Bootstrap.java
  • 19. while (true) { if (LocalDateTime.now().isAfter(stopAt)) break; Session s = sessions.get(random.nextInt((int) sessions.size())); get(s, "/login"); get(s, "/css/bootstrap.min.css"); get(s, "/css/signin.css"); post(s, "/login", formLogin(s)); if (LocalDateTime.now().isAfter(stopAt)) break; get(s, "/"); get(s, "/css/bootstrap.min.css"); get(s, "/css/jumbotron-narrow.css"); get(s, "/js/jquery-1.11.3.js"); get(s, "/js/bootstrap.js"); get(s, "/js/airisu.js"); get(s, "/user.js"); if (LocalDateTime.now().isAfter(stopAt)) break; for (int i = 0 ; i < 10 ; i++) { get(s, "/data"); if (LocalDateTime.now().isAfter(stopAt)) break; } if (LocalDateTime.now().isAfter(stopAt)) break; } Load.java
  • 20. @Override public Result finishHook(Result result) { long requests = result.requests; if (result.responses.exception * 100.0 / (requests * 1.0) >= 1.0) { result.addViolation("Too many exceptions", "通信エラー等の失敗が多過ぎます(1%以上)"); result.fail(); } if (result.responses.error * 100.0 / (requests * 1.0) >= 1.0) { result.addViolation("Too many errors", "ステータス 5xx のレスポンスが多過ぎます(1%以上)"); result.fail(); } if (result.responses.failure * 100.0 / (requests * 1.0) >= 5.0) { result.addViolation("Too many failures", "ステータス 4xx のレスポンスが多過ぎます(5%以上)"); result.fail(); } return result; } @Override public Step[] steps() { Step[] steps = new Step[3]; steps[0] = new Step(35000L, Init.class); steps[1] = new Step(60000L, Bootstrap.class); steps[2] = new Step( 70000L, Checker.class, ModifyLoader.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class, Load.class ); return steps; } Full.java
  • 21. Code Example • Simple scenario • https://github.com/isucon/isucon5-nal/blob/master/bench/src/main/java/net/isucon/ isucon5f/bench/Load.java • https://github.com/isucon/isucon5-nal/blob/master/bench/src/main/java/net/isucon/ isucon5f/bench/Checker.java • https://github.com/isucon/isucon5-nal/blob/master/bench/src/main/java/net/isucon/ isucon5f/bench/Bootstrap.java • https://github.com/isucon/isucon5-nal/blob/master/bench/src/main/java/net/isucon/ isucon5f/bench/Init.java • Complex scenario • https://github.com/isucon/isucon5-nal/blob/master/bench/src/main/java/net/isucon/ isucon5f/bench/Full.java
  • 22. Distributed Benchmarking • N nodes for 1 benchmark • Can a node perform fast enough? (CPU bounded) • Y -> 1 vs 1, N -> 2 vs 1 • "GET /": 5000req/thread on localhost -> enough • N nodes for many benchmarks • Scale out strategy • Queue/worker system
  • 23. Scaling out nodes ISUCON Portal (RoR) Queue (MySQL) Daemon script (ruby) Bench (Java) Daemon script (ruby) Daemon script (ruby) Daemon script (ruby) Bench (Java) ack req/set result Daemon script (ruby) Bench (Java)
  • 24. Recorded Performance • about 194,000 requests / 60 sec • OK: 185,000 • Redirects: 9,300 • Peak 30 nodes (Qualify) • 11,500 benchmarks in 2days
  • 25. Far more: Scenario • Checking for critical issues / non-critical issues • Critical/non-critical mode of Checker class • Checks w/ dependencies • If a check fails, following checks throws NPE :(
  • 26. Some More Topics • Async • Gigantic parallel requests • 2 or more simultaneous requests under control
  • 27. Java8: What and How I feel about it