ソーシャルアプリ向けシステム監視運用の勘所

Tatsuro Hisamori
Tatsuro Hisamori日本マイクロソフト/ Microsoft Japan - Technical Evangelist at 日本マイクロソフト/ Microsoft Japan
Tatsuro Hisamori
                  DeNA Co.,Ltd.




2010   10   17
•              (Tatsuro Hisamori)

                 •
                     •   mbga OpenPlatform

                         •           /

                         •
                         •         etc

2010   10   17
mbga OpenPlatform

                 •                 16:00    id:ZIGOROu
                     Inside mbga Platform

                                            (^0^v




2010   10   17
• Social Application   /




2010   10   17
•



                 •

2010   10   17
2010   10   17
•
                     •
                 •   Gadget / API

                     •
                 •   Platform

                     •
                 •              tcpdump

2010   10   17
•
                     •


                 •       DB

                     •
2010   10   17
•
                 •
            • DB
                 •
            •
                 •
2010   10   17
• request -> response
                  • WAF
                    •         request    finalize

                  • Apache
                    • CustomLog %D
2010   10   17
use Time::HiRes qw/gettimeofday tv_interval/;

       sub pre_request {
         my ( $c, $args ) = @_;

            $c->stash->{__start_time} = [gettimeofday];
       }

       sub finalize {
         my ( $c, $args ) = @_;

            $c->log->debug( $process_time = tv_interval($c->stash->{__start_time},
            [gettimeofday]));
       }


2010   10   17
• %D               GadgetServer

            •        %D    request line                     response


                  # protocol.c (httpd-2.2.16)
                 static int read_request_line(request_rec *r, apr_bucket_brigade *bb)
                  {

                 r->request_time = apr_time_now();

                 }


2010   10   17
• GadgetServer
        • alarm() SIGALRM
                 #
                 eval {
                   local $SIG{ALRM} = sub {die};
                   alarm($TIMEOUT);
                   $response = $ua->request($URL);
                   alarm(0);
                 }

                                           )
2010   10   17
•
                     TCP

                     • tcpdump + wireshark
                         Casual              (^0^v



2010   10   17
$ tcpdump -i bond0 -s 1500 -n –w tcp.dump 'host gadgetserver'



                  • -w

                  •                               wireshark

                      •                                 stream

2010   10   17
DB


                 • DB
                  • DBI::Profile
                  • DBIx::ProfileManager
                  • mk-query-digest(maatkit)

2010   10   17
DBI::Profile
            • DBI
                 use DBI;
                 use DBI::Profile;

                 my $dbh = DBI->connect("dbi:mysql:db=test;”,"root", ””);
                 $dbh->{Profile} = q|!Statement|;
                 $dbh->selectall_arrayref("SELECT ?", undef, $_) for ( qw/1 2 3/ );




       DBI::Profile: 0.000399s 91.38% (7 calls) test.pl @ 2010-10-12 21:08:03
       'SELECT ?' =>
          0.000399s / 7 = 0.000057s avg (first 0.000177s, min 0.000002s, max 0.000177s)


2010   10   17
DBIx::ProfileManager
            • handle                 attibute


                 use DBI;
                 use DBIx::ProfileManager;

                 my $dbh = DBI->connect(...);

                 my $pm = DBIx::ProfileManager->new;
                 $pm->profile_start;

                 my $res = $dbh->selectall_arrayref(...);

                 $pm->profile_stop;
                 my @results = $pm->data_formatted;
                 local $, = "n"; print @results;
2010   10   17
DBIx::ProfileManager

            • profile_start profile_stop
            • data_formatted format
                 # sample
                 $pm->data_formatted(
                    q|%{statement} : %{max}, %{min}, %{avg}|
                 );

        •                   DeNA

             •   http://engineer.dena.jp/2010/03/dbixprofilemanager-sql-profiling.html

2010   10   17
Catalyst
        # MyApp.pm
       use DBIx::ProfileManager;

       sub prepare_request {
         my ( $c, $args ) = @_;

            my $pm = DBIx::ProfileManager->new(%config);
            $pm->profile_start;
            $c->stash->{__dbix_profilemanager} = $pm;

       }

       sub finalize {
         my ( $c, $args ) = @_;

            my $pm = $c->stash->{__dbix_priflemanager};
            $pm->profile_stop;
            #     $pm->data_formatted
       }


2010   10   17
DB

            •    slowlog                                        mk-query-digest
                       # Query 8: 44.67 QPS, 0.13x concurrency, ID 0x6516D7E6698E425A at byte 108467522
                       # Attribute pct total min max avg 95% stddev median
                       # ========= ====== ======= ======= ======= ======= ======= ======= =======
                       # Count           2 317
                       # Exec time        2 944ms       0 205ms 3ms 2ms 22ms 108us
                       # Hosts              181 10.5.9.20 (7/2%), 10.5.10.157 (6/1%)... 179 more
                       # Databases            1 platform
                       # Time range 2010-10-12 13:21:53.218711 to 2010-10-12 13:22:00.315719
                       # bytes         1 20.43k     66     68 66.01 65.89         0 65.89
                       # Errors              1 none
                       # Rows affe       0    0      0     0     0      0    0     0
                       # Warning c        0    0     0     0      0     0     0    0
                       # Query_time distribution
                       # 1us
                       # 10us ####################################################
                       # 100us ################################################################
                       # 1ms #########
                       # 10ms #
                       # 100ms #
                       # 1s
                       # 10s+
                       # Tables
                       # SHOW TABLE STATUS FROM `db` LIKE 'entry'G
                       # SHOW CREATE TABLE `db`.`entry`G
                       # EXPLAIN
                       select id, type from entry where id = xxx
                       G


2010   10   17
DB
                     •
            # Query_time distribution
            # 1us
            # 10us ####################################################
            # 100us ######################################################
            # 1ms #########
            # 10ms #
            # 100ms #
            # 1s
            # 10s+


                 •
                 •            SQL                                explain


2010   10   17
•
                 •
                 •
                             ↓
             mk-query-digest tcpdump     !!
                     mysql       dump   OK
2010   10   17
DB
                 •
                     •

                 •
                     •
                     •
                     •
2010   10   17
DB
                 •
                     •
  $mysqladmin -uroot -p extended-STATUS | egrep '(Max|Threads_)'
  | Max_used_connections       | 68      |
  | Threads_cached             | 36      |
  | Threads_connected          | 32      |
  | Threads_created           | 68       |
  | Threads_running           |5         |



2010   10   17
DB
                  •
                      •

                 $ mysqladmin -uroot -p -hdbsrv status | awk '{print $22}'
                 9780.895




2010   10   17
DB
                 •
                     •
   $ sar
   13:00:01              CPU   %user   %nice   %system   %iowait   %idle
   13:10:01              all   0.97    0.00    0.32      0.36      98.35
   13:20:01              all   0.80    0.00    0.30      0.25      98.65
   13:30:01              all   0.81    0.00    0.29      0.28      98.62
   13:40:01              all   0.73    0.00    0.28      0.24      98.76



2010   10   17
ex. open Platform

                 •
                 •
                 •


                 •
                 •

2010   10   17
•
                     • from tcpdump & GadgetServer   timeout

                 •
                             100   200ms



                     • ex.
2010   10   17
•

            •    ping, traceroute etc

       •
            •                            10ms   (   )


            •           EC2       100ms 200ms

2010   10   17
•
            • platform <->
            •         <->    (Web <-> DB)

            • VM
       •           I/O

            •
2010   10   17
•

                     •   ex. Platform
                             @mbga OpenPlatform

                 •
                                                  TCO


2010   10   17
•
                 •
            •    DB

                 •
            •
                 •

2010   10   17
2010   10   17
Thanks!


2010   10   17
1 of 35

Recommended

Inside MongoDB: the Internals of an Open-Source Database by
Inside MongoDB: the Internals of an Open-Source DatabaseInside MongoDB: the Internals of an Open-Source Database
Inside MongoDB: the Internals of an Open-Source DatabaseMike Dirolf
52.5K views25 slides
PHP 7 – What changed internally? by
PHP 7 – What changed internally?PHP 7 – What changed internally?
PHP 7 – What changed internally?Nikita Popov
13.2K views122 slides
PHP 7 – What changed internally? (Forum PHP 2015) by
PHP 7 – What changed internally? (Forum PHP 2015)PHP 7 – What changed internally? (Forum PHP 2015)
PHP 7 – What changed internally? (Forum PHP 2015)Nikita Popov
7.5K views83 slides
AnyMQ, Hippie, and the real-time web by
AnyMQ, Hippie, and the real-time webAnyMQ, Hippie, and the real-time web
AnyMQ, Hippie, and the real-time webclkao
4K views98 slides
Webinar: Building Your First App in Node.js by
Webinar: Building Your First App in Node.jsWebinar: Building Your First App in Node.js
Webinar: Building Your First App in Node.jsMongoDB
633 views92 slides
How to stand on the shoulders of giants by
How to stand on the shoulders of giantsHow to stand on the shoulders of giants
How to stand on the shoulders of giantsIan Barber
3.6K views32 slides

More Related Content

What's hot

MongoDB: Optimising for Performance, Scale & Analytics by
MongoDB: Optimising for Performance, Scale & AnalyticsMongoDB: Optimising for Performance, Scale & Analytics
MongoDB: Optimising for Performance, Scale & AnalyticsServer Density
555 views96 slides
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course by
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash courseCodepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash courseSages
925 views76 slides
MongoDB: How it Works by
MongoDB: How it WorksMongoDB: How it Works
MongoDB: How it WorksMike Dirolf
13.5K views12 slides
ZeroMQ Is The Answer: DPC 11 Version by
ZeroMQ Is The Answer: DPC 11 VersionZeroMQ Is The Answer: DPC 11 Version
ZeroMQ Is The Answer: DPC 11 VersionIan Barber
1.7K views50 slides
Opa hackathon by
Opa hackathonOpa hackathon
Opa hackathonHenri Binsztok
516 views72 slides
Redis for the Everyday Developer by
Redis for the Everyday DeveloperRedis for the Everyday Developer
Redis for the Everyday DeveloperRoss Tuck
70.9K views196 slides

What's hot(20)

MongoDB: Optimising for Performance, Scale & Analytics by Server Density
MongoDB: Optimising for Performance, Scale & AnalyticsMongoDB: Optimising for Performance, Scale & Analytics
MongoDB: Optimising for Performance, Scale & Analytics
Server Density555 views
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course by Sages
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash courseCodepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Sages925 views
MongoDB: How it Works by Mike Dirolf
MongoDB: How it WorksMongoDB: How it Works
MongoDB: How it Works
Mike Dirolf13.5K views
ZeroMQ Is The Answer: DPC 11 Version by Ian Barber
ZeroMQ Is The Answer: DPC 11 VersionZeroMQ Is The Answer: DPC 11 Version
ZeroMQ Is The Answer: DPC 11 Version
Ian Barber1.7K views
Redis for the Everyday Developer by Ross Tuck
Redis for the Everyday DeveloperRedis for the Everyday Developer
Redis for the Everyday Developer
Ross Tuck70.9K views
It's 10pm: Do You Know Where Your Writes Are? by MongoDB
It's 10pm: Do You Know Where Your Writes Are?It's 10pm: Do You Know Where Your Writes Are?
It's 10pm: Do You Know Where Your Writes Are?
MongoDB2.6K views
Caching and tuning fun for high scalability @ LOAD2012 by Wim Godden
Caching and tuning fun for high scalability @ LOAD2012Caching and tuning fun for high scalability @ LOAD2012
Caching and tuning fun for high scalability @ LOAD2012
Wim Godden1.6K views
Roll Your Own API Management Platform with nginx and Lua by Jon Moore
Roll Your Own API Management Platform with nginx and LuaRoll Your Own API Management Platform with nginx and Lua
Roll Your Own API Management Platform with nginx and Lua
Jon Moore47.4K views
PHP data structures (and the impact of php 7 on them), phpDay Verona 2015, Italy by Patrick Allaert
PHP data structures (and the impact of php 7 on them), phpDay Verona 2015, ItalyPHP data structures (and the impact of php 7 on them), phpDay Verona 2015, Italy
PHP data structures (and the impact of php 7 on them), phpDay Verona 2015, Italy
Patrick Allaert20.8K views
Database Wizardry for Legacy Applications by Gabriela Ferrara
Database Wizardry for Legacy ApplicationsDatabase Wizardry for Legacy Applications
Database Wizardry for Legacy Applications
Gabriela Ferrara1.9K views
Caching and tuning fun for high scalability by Wim Godden
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalability
Wim Godden1.5K views
DashProfiler 200807 by Tim Bunce
DashProfiler 200807DashProfiler 200807
DashProfiler 200807
Tim Bunce830 views
Abusing text/template for data transformation by Arnaud Porterie
Abusing text/template for data transformationAbusing text/template for data transformation
Abusing text/template for data transformation
Arnaud Porterie1.9K views
MongoDB Analytics by datablend
MongoDB AnalyticsMongoDB Analytics
MongoDB Analytics
datablend2.2K views
Nko workshop - node js crud & deploy by Simon Su
Nko workshop - node js crud & deployNko workshop - node js crud & deploy
Nko workshop - node js crud & deploy
Simon Su2.9K views
Lua tech talk by Locaweb
Lua tech talkLua tech talk
Lua tech talk
Locaweb2.3K views
Performance measurement and tuning by AOE
Performance measurement and tuningPerformance measurement and tuning
Performance measurement and tuning
AOE2.3K views
はじめてのMongoDB by Takahiro Inoue
はじめてのMongoDBはじめてのMongoDB
はじめてのMongoDB
Takahiro Inoue16.1K views
The promise of asynchronous php by Wim Godden
The promise of asynchronous phpThe promise of asynchronous php
The promise of asynchronous php
Wim Godden1.1K views

Viewers also liked

YAPCEurope2014-myfinder by
YAPCEurope2014-myfinderYAPCEurope2014-myfinder
YAPCEurope2014-myfinderTatsuro Hisamori
2.9K views34 slides
YAPC::Europe 2014 に行ってきました by
YAPC::Europe 2014 に行ってきましたYAPC::Europe 2014 に行ってきました
YAPC::Europe 2014 に行ってきましたTatsuro Hisamori
3.2K views31 slides
Riakmeetup2forupload by
Riakmeetup2foruploadRiakmeetup2forupload
Riakmeetup2foruploadTatsuro Hisamori
2.6K views41 slides
平均レスポンスタイム50msをPerlで捌く中規模サービスの実装/運用 by
平均レスポンスタイム50msをPerlで捌く中規模サービスの実装/運用平均レスポンスタイム50msをPerlで捌く中規模サービスの実装/運用
平均レスポンスタイム50msをPerlで捌く中規模サービスの実装/運用Tatsuro Hisamori
11.7K views86 slides
My sql event_scheduler_casual_slideshare__ by
My sql event_scheduler_casual_slideshare__My sql event_scheduler_casual_slideshare__
My sql event_scheduler_casual_slideshare__Tatsuro Hisamori
9.3K views27 slides
今更聞けないストリーム処理のあれとかこれ by
今更聞けないストリーム処理のあれとかこれ今更聞けないストリーム処理のあれとかこれ
今更聞けないストリーム処理のあれとかこれTatsuro Hisamori
11.3K views26 slides

Viewers also liked(6)

YAPC::Europe 2014 に行ってきました by Tatsuro Hisamori
YAPC::Europe 2014 に行ってきましたYAPC::Europe 2014 に行ってきました
YAPC::Europe 2014 に行ってきました
Tatsuro Hisamori3.2K views
平均レスポンスタイム50msをPerlで捌く中規模サービスの実装/運用 by Tatsuro Hisamori
平均レスポンスタイム50msをPerlで捌く中規模サービスの実装/運用平均レスポンスタイム50msをPerlで捌く中規模サービスの実装/運用
平均レスポンスタイム50msをPerlで捌く中規模サービスの実装/運用
Tatsuro Hisamori11.7K views
My sql event_scheduler_casual_slideshare__ by Tatsuro Hisamori
My sql event_scheduler_casual_slideshare__My sql event_scheduler_casual_slideshare__
My sql event_scheduler_casual_slideshare__
Tatsuro Hisamori9.3K views
今更聞けないストリーム処理のあれとかこれ by Tatsuro Hisamori
今更聞けないストリーム処理のあれとかこれ今更聞けないストリーム処理のあれとかこれ
今更聞けないストリーム処理のあれとかこれ
Tatsuro Hisamori11.3K views

Similar to ソーシャルアプリ向けシステム監視運用の勘所

Beyond php it's not (just) about the code by
Beyond php   it's not (just) about the codeBeyond php   it's not (just) about the code
Beyond php it's not (just) about the codeWim Godden
3.5K views56 slides
Beyond PHP - It's not (just) about the code by
Beyond PHP - It's not (just) about the codeBeyond PHP - It's not (just) about the code
Beyond PHP - It's not (just) about the codeWim Godden
2.9K views56 slides
Beyond PHP - it's not (just) about the code by
Beyond PHP - it's not (just) about the codeBeyond PHP - it's not (just) about the code
Beyond PHP - it's not (just) about the codeWim Godden
9.1K views56 slides
Beyond php - it's not (just) about the code by
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeWim Godden
3.8K views59 slides
Spark Streaming with Cassandra by
Spark Streaming with CassandraSpark Streaming with Cassandra
Spark Streaming with CassandraJacek Lewandowski
3.8K views53 slides
Consul ou comment bien tirer sur l’élastique by
 Consul ou comment bien tirer sur l’élastique Consul ou comment bien tirer sur l’élastique
Consul ou comment bien tirer sur l’élastiqueNicolas Ledez
167 views160 slides

Similar to ソーシャルアプリ向けシステム監視運用の勘所(20)

Beyond php it's not (just) about the code by Wim Godden
Beyond php   it's not (just) about the codeBeyond php   it's not (just) about the code
Beyond php it's not (just) about the code
Wim Godden3.5K views
Beyond PHP - It's not (just) about the code by Wim Godden
Beyond PHP - It's not (just) about the codeBeyond PHP - It's not (just) about the code
Beyond PHP - It's not (just) about the code
Wim Godden2.9K views
Beyond PHP - it's not (just) about the code by Wim Godden
Beyond PHP - it's not (just) about the codeBeyond PHP - it's not (just) about the code
Beyond PHP - it's not (just) about the code
Wim Godden9.1K views
Beyond php - it's not (just) about the code by Wim Godden
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the code
Wim Godden3.8K views
Consul ou comment bien tirer sur l’élastique by Nicolas Ledez
 Consul ou comment bien tirer sur l’élastique Consul ou comment bien tirer sur l’élastique
Consul ou comment bien tirer sur l’élastique
Nicolas Ledez167 views
Performance measurement and tuning by AOE
Performance measurement and tuningPerformance measurement and tuning
Performance measurement and tuning
AOE 1.4K views
Ensuring High Availability for Real-time Analytics featuring Boxed Ice / Serv... by MongoDB
Ensuring High Availability for Real-time Analytics featuring Boxed Ice / Serv...Ensuring High Availability for Real-time Analytics featuring Boxed Ice / Serv...
Ensuring High Availability for Real-time Analytics featuring Boxed Ice / Serv...
MongoDB602 views
How to use the new Domino Query Language by Tim Davis
How to use the new Domino Query LanguageHow to use the new Domino Query Language
How to use the new Domino Query Language
Tim Davis3.1K views
High-Performance Hibernate Devoxx France 2016 by Vlad Mihalcea
High-Performance Hibernate Devoxx France 2016High-Performance Hibernate Devoxx France 2016
High-Performance Hibernate Devoxx France 2016
Vlad Mihalcea17.3K views
Reactive Stream Processing Using DDS and Rx by Sumant Tambe
Reactive Stream Processing Using DDS and RxReactive Stream Processing Using DDS and Rx
Reactive Stream Processing Using DDS and Rx
Sumant Tambe2.2K views
Fosdem10 by wremes
Fosdem10Fosdem10
Fosdem10
wremes1.2K views
Emerging Languages: A Tour of the Horizon by Alex Payne
Emerging Languages: A Tour of the HorizonEmerging Languages: A Tour of the Horizon
Emerging Languages: A Tour of the Horizon
Alex Payne6.3K views
Percona Toolkit for Effective MySQL Administration by Mydbops
Percona Toolkit for Effective MySQL AdministrationPercona Toolkit for Effective MySQL Administration
Percona Toolkit for Effective MySQL Administration
Mydbops1.8K views
String Comparison Surprises: Did Postgres lose my data? by Jeremy Schneider
String Comparison Surprises: Did Postgres lose my data?String Comparison Surprises: Did Postgres lose my data?
String Comparison Surprises: Did Postgres lose my data?

Recently uploaded

The details of description: Techniques, tips, and tangents on alternative tex... by
The details of description: Techniques, tips, and tangents on alternative tex...The details of description: Techniques, tips, and tangents on alternative tex...
The details of description: Techniques, tips, and tangents on alternative tex...BookNet Canada
110 views24 slides
Astera Labs: Intelligent Connectivity for Cloud and AI Infrastructure by
Astera Labs:  Intelligent Connectivity for Cloud and AI InfrastructureAstera Labs:  Intelligent Connectivity for Cloud and AI Infrastructure
Astera Labs: Intelligent Connectivity for Cloud and AI InfrastructureCXL Forum
125 views16 slides
Five Things You SHOULD Know About Postman by
Five Things You SHOULD Know About PostmanFive Things You SHOULD Know About Postman
Five Things You SHOULD Know About PostmanPostman
25 views43 slides
Beyond the Hype: What Generative AI Means for the Future of Work - Damien Cum... by
Beyond the Hype: What Generative AI Means for the Future of Work - Damien Cum...Beyond the Hype: What Generative AI Means for the Future of Work - Damien Cum...
Beyond the Hype: What Generative AI Means for the Future of Work - Damien Cum...NUS-ISS
28 views35 slides
CXL at OCP by
CXL at OCPCXL at OCP
CXL at OCPCXL Forum
208 views66 slides
Data-centric AI and the convergence of data and model engineering: opportunit... by
Data-centric AI and the convergence of data and model engineering:opportunit...Data-centric AI and the convergence of data and model engineering:opportunit...
Data-centric AI and the convergence of data and model engineering: opportunit...Paolo Missier
29 views40 slides

Recently uploaded(20)

The details of description: Techniques, tips, and tangents on alternative tex... by BookNet Canada
The details of description: Techniques, tips, and tangents on alternative tex...The details of description: Techniques, tips, and tangents on alternative tex...
The details of description: Techniques, tips, and tangents on alternative tex...
BookNet Canada110 views
Astera Labs: Intelligent Connectivity for Cloud and AI Infrastructure by CXL Forum
Astera Labs:  Intelligent Connectivity for Cloud and AI InfrastructureAstera Labs:  Intelligent Connectivity for Cloud and AI Infrastructure
Astera Labs: Intelligent Connectivity for Cloud and AI Infrastructure
CXL Forum125 views
Five Things You SHOULD Know About Postman by Postman
Five Things You SHOULD Know About PostmanFive Things You SHOULD Know About Postman
Five Things You SHOULD Know About Postman
Postman25 views
Beyond the Hype: What Generative AI Means for the Future of Work - Damien Cum... by NUS-ISS
Beyond the Hype: What Generative AI Means for the Future of Work - Damien Cum...Beyond the Hype: What Generative AI Means for the Future of Work - Damien Cum...
Beyond the Hype: What Generative AI Means for the Future of Work - Damien Cum...
NUS-ISS28 views
CXL at OCP by CXL Forum
CXL at OCPCXL at OCP
CXL at OCP
CXL Forum208 views
Data-centric AI and the convergence of data and model engineering: opportunit... by Paolo Missier
Data-centric AI and the convergence of data and model engineering:opportunit...Data-centric AI and the convergence of data and model engineering:opportunit...
Data-centric AI and the convergence of data and model engineering: opportunit...
Paolo Missier29 views
Future of Learning - Yap Aye Wee.pdf by NUS-ISS
Future of Learning - Yap Aye Wee.pdfFuture of Learning - Yap Aye Wee.pdf
Future of Learning - Yap Aye Wee.pdf
NUS-ISS38 views
Future of Learning - Khoong Chan Meng by NUS-ISS
Future of Learning - Khoong Chan MengFuture of Learning - Khoong Chan Meng
Future of Learning - Khoong Chan Meng
NUS-ISS31 views
The Importance of Cybersecurity for Digital Transformation by NUS-ISS
The Importance of Cybersecurity for Digital TransformationThe Importance of Cybersecurity for Digital Transformation
The Importance of Cybersecurity for Digital Transformation
NUS-ISS25 views
Combining Orchestration and Choreography for a Clean Architecture by ThomasHeinrichs1
Combining Orchestration and Choreography for a Clean ArchitectureCombining Orchestration and Choreography for a Clean Architecture
Combining Orchestration and Choreography for a Clean Architecture
ThomasHeinrichs168 views
Micron CXL product and architecture update by CXL Forum
Micron CXL product and architecture updateMicron CXL product and architecture update
Micron CXL product and architecture update
CXL Forum27 views
AMD: 4th Generation EPYC CXL Demo by CXL Forum
AMD: 4th Generation EPYC CXL DemoAMD: 4th Generation EPYC CXL Demo
AMD: 4th Generation EPYC CXL Demo
CXL Forum126 views
MemVerge: Past Present and Future of CXL by CXL Forum
MemVerge: Past Present and Future of CXLMemVerge: Past Present and Future of CXL
MemVerge: Past Present and Future of CXL
CXL Forum110 views
Transcript: The Details of Description Techniques tips and tangents on altern... by BookNet Canada
Transcript: The Details of Description Techniques tips and tangents on altern...Transcript: The Details of Description Techniques tips and tangents on altern...
Transcript: The Details of Description Techniques tips and tangents on altern...
BookNet Canada119 views
"Quality Assurance: Achieving Excellence in startup without a Dedicated QA", ... by Fwdays
"Quality Assurance: Achieving Excellence in startup without a Dedicated QA", ..."Quality Assurance: Achieving Excellence in startup without a Dedicated QA", ...
"Quality Assurance: Achieving Excellence in startup without a Dedicated QA", ...
Fwdays33 views
.conf Go 2023 - How KPN drives Customer Satisfaction on IPTV by Splunk
.conf Go 2023 - How KPN drives Customer Satisfaction on IPTV.conf Go 2023 - How KPN drives Customer Satisfaction on IPTV
.conf Go 2023 - How KPN drives Customer Satisfaction on IPTV
Splunk86 views

ソーシャルアプリ向けシステム監視運用の勘所

  • 1. Tatsuro Hisamori DeNA Co.,Ltd. 2010 10 17
  • 2. (Tatsuro Hisamori) • • mbga OpenPlatform • / • • etc 2010 10 17
  • 3. mbga OpenPlatform • 16:00 id:ZIGOROu Inside mbga Platform (^0^v 2010 10 17
  • 4. • Social Application / 2010 10 17
  • 5. • 2010 10 17
  • 6. 2010 10 17
  • 7. • • Gadget / API • • Platform • • tcpdump 2010 10 17
  • 8. • • DB • 2010 10 17
  • 9. • • DB • • • 2010 10 17
  • 10. • request -> response • WAF • request finalize • Apache • CustomLog %D 2010 10 17
  • 11. use Time::HiRes qw/gettimeofday tv_interval/; sub pre_request { my ( $c, $args ) = @_; $c->stash->{__start_time} = [gettimeofday]; } sub finalize { my ( $c, $args ) = @_; $c->log->debug( $process_time = tv_interval($c->stash->{__start_time}, [gettimeofday])); } 2010 10 17
  • 12. • %D GadgetServer • %D request line response # protocol.c (httpd-2.2.16) static int read_request_line(request_rec *r, apr_bucket_brigade *bb) { r->request_time = apr_time_now(); } 2010 10 17
  • 13. • GadgetServer • alarm() SIGALRM # eval { local $SIG{ALRM} = sub {die}; alarm($TIMEOUT); $response = $ua->request($URL); alarm(0); } ) 2010 10 17
  • 14. TCP • tcpdump + wireshark Casual (^0^v 2010 10 17
  • 15. $ tcpdump -i bond0 -s 1500 -n –w tcp.dump 'host gadgetserver' • -w • wireshark • stream 2010 10 17
  • 16. DB • DB • DBI::Profile • DBIx::ProfileManager • mk-query-digest(maatkit) 2010 10 17
  • 17. DBI::Profile • DBI use DBI; use DBI::Profile; my $dbh = DBI->connect("dbi:mysql:db=test;”,"root", ””); $dbh->{Profile} = q|!Statement|; $dbh->selectall_arrayref("SELECT ?", undef, $_) for ( qw/1 2 3/ ); DBI::Profile: 0.000399s 91.38% (7 calls) test.pl @ 2010-10-12 21:08:03 'SELECT ?' => 0.000399s / 7 = 0.000057s avg (first 0.000177s, min 0.000002s, max 0.000177s) 2010 10 17
  • 18. DBIx::ProfileManager • handle attibute use DBI; use DBIx::ProfileManager; my $dbh = DBI->connect(...); my $pm = DBIx::ProfileManager->new; $pm->profile_start; my $res = $dbh->selectall_arrayref(...); $pm->profile_stop; my @results = $pm->data_formatted; local $, = "n"; print @results; 2010 10 17
  • 19. DBIx::ProfileManager • profile_start profile_stop • data_formatted format # sample $pm->data_formatted( q|%{statement} : %{max}, %{min}, %{avg}| ); • DeNA • http://engineer.dena.jp/2010/03/dbixprofilemanager-sql-profiling.html 2010 10 17
  • 20. Catalyst # MyApp.pm use DBIx::ProfileManager; sub prepare_request { my ( $c, $args ) = @_; my $pm = DBIx::ProfileManager->new(%config); $pm->profile_start; $c->stash->{__dbix_profilemanager} = $pm; } sub finalize { my ( $c, $args ) = @_; my $pm = $c->stash->{__dbix_priflemanager}; $pm->profile_stop; # $pm->data_formatted } 2010 10 17
  • 21. DB • slowlog mk-query-digest # Query 8: 44.67 QPS, 0.13x concurrency, ID 0x6516D7E6698E425A at byte 108467522 # Attribute pct total min max avg 95% stddev median # ========= ====== ======= ======= ======= ======= ======= ======= ======= # Count 2 317 # Exec time 2 944ms 0 205ms 3ms 2ms 22ms 108us # Hosts 181 10.5.9.20 (7/2%), 10.5.10.157 (6/1%)... 179 more # Databases 1 platform # Time range 2010-10-12 13:21:53.218711 to 2010-10-12 13:22:00.315719 # bytes 1 20.43k 66 68 66.01 65.89 0 65.89 # Errors 1 none # Rows affe 0 0 0 0 0 0 0 0 # Warning c 0 0 0 0 0 0 0 0 # Query_time distribution # 1us # 10us #################################################### # 100us ################################################################ # 1ms ######### # 10ms # # 100ms # # 1s # 10s+ # Tables # SHOW TABLE STATUS FROM `db` LIKE 'entry'G # SHOW CREATE TABLE `db`.`entry`G # EXPLAIN select id, type from entry where id = xxx G 2010 10 17
  • 22. DB • # Query_time distribution # 1us # 10us #################################################### # 100us ###################################################### # 1ms ######### # 10ms # # 100ms # # 1s # 10s+ • • SQL explain 2010 10 17
  • 23. • • ↓ mk-query-digest tcpdump !! mysql dump OK 2010 10 17
  • 24. DB • • • • • • 2010 10 17
  • 25. DB • • $mysqladmin -uroot -p extended-STATUS | egrep '(Max|Threads_)' | Max_used_connections | 68 | | Threads_cached | 36 | | Threads_connected | 32 | | Threads_created | 68 | | Threads_running |5 | 2010 10 17
  • 26. DB • • $ mysqladmin -uroot -p -hdbsrv status | awk '{print $22}' 9780.895 2010 10 17
  • 27. DB • • $ sar 13:00:01 CPU %user %nice %system %iowait %idle 13:10:01 all 0.97 0.00 0.32 0.36 98.35 13:20:01 all 0.80 0.00 0.30 0.25 98.65 13:30:01 all 0.81 0.00 0.29 0.28 98.62 13:40:01 all 0.73 0.00 0.28 0.24 98.76 2010 10 17
  • 28. ex. open Platform • • • • • 2010 10 17
  • 29. • from tcpdump & GadgetServer timeout • 100 200ms • ex. 2010 10 17
  • 30. • ping, traceroute etc • • 10ms ( ) • EC2 100ms 200ms 2010 10 17
  • 31. • platform <-> • <-> (Web <-> DB) • VM • I/O • 2010 10 17
  • 32. • ex. Platform @mbga OpenPlatform • TCO 2010 10 17
  • 33. • • DB • • • 2010 10 17
  • 34. 2010 10 17
  • 35. Thanks! 2010 10 17