SlideShare a Scribd company logo
my $memd = Cache::Memcached::Fast->new({
	   servers => [qw!192.168.67.31:11211 192.168.67.32:11211!]
});

if ( my $nickname = $memd->get('nickname:1') ) {
	   return $nickname;
}

my $dbh = DBI->connect('DBI:mysql:boofy:host=localhost');
my $nickname = $dbh->selectrow_array(
    'SELECT nickname FROM user WHERE id=?', undef, 1);
if ( $nickname ) {
	   $memd->add('nickname:1', $nickname, 24*60*60);
	   return $nickname;
}

return;
% ./memstrike -l localhost -p 11211 -t 10 -k 8 -v 8 50000
number of threads    : 10
number of requests   : 50000
requests per thread : 5000
get multiplex        : 1
size of key          : 8 bytes
size of value        : 8 bytes
----
[gggggggggg] ...
0.683260 sec
0.762939 MB
9.366859 Mbps
73178.585019 req/sec
13.665200 usec/req
VS
VS
memcached   ×
% sudo ./memcached -c 262144 -u nobody
4532 int maxfiles = settings.maxconns;
4533 if (rlim.rlim_cur < maxfiles)
4534     rlim.rlim_cur = maxfiles;
4535 if (rlim.rlim_max < rlim.rlim_cur)
4536     rlim.rlim_max = rlim.rlim_cur;
4537 if (setrlimit(RLIMIT_NOFILE, &rlim) != 0) {
4538     fprintf(stderr, "failed to set rlimit for open
files. Try running as root or requesting smaller
maxconns value.n");
4539     exit(EX_OSERR);
4540 }
% ./memcached -l 127.0.0.1
% ./memcached -l 192.168.67.31
% ./memcached -l 192.168.67.31

..

% ssh myserver
% telnet localhost 11211
Trying ::1...
Trying 127.0.0.1...
telnet: Unable to connect to remote host:
Connection refused
% sudo ./memcached -c 262144 -u nobody
% ./memcached -vvv
slab class   1: chunk size       96 perslab    10922


slab class 40: chunk size    1048576 perslab      1
<26 server listening (auto-negotiate)
<27 server listening (auto-negotiate)
<28 send buffer was 124928, now 268435456
<28 server listening (udp)
<28 server listening (udp)
<28 server listening (udp)
<28 server listening (udp)
<29 send buffer was 124928, now 268435456
<29 server listening (udp)
<29 server listening (udp)
<29 server listening (udp)
<29 server listening (udp)
% ./memcached -p 11211 -U 0
% ./memcached -U 0




% ./memcached -U 12345
% ./memcached -m 16G
% ./memcached -C -m 16G
% ./memcached -c 32768 -u nobody 
              -C -m 16G -p 11211 -U 0
% telnet localhost 11211
Trying ::1...
Connected to localhost.
Escape character is '^]'.
stats settings
STAT   maxbytes 16777216
STAT   maxconns 32768
STAT   tcpport 11211
STAT   udpport 0
STAT   inter NULL
STAT   verbosity 0
STAT   oldest 0
STAT   evictions on
STAT   growth_factor 1.25
STAT   chunk_size 48
STAT   num_threads 4
STAT   cas_enabled no
STAT   tcp_backlog 4096
STAT   binding_protocol auto-negotiate
STAT   auth_enabled_sasl no
STAT   item_size_max 1048576
END
define host{
  use         generic-host
  host_name    memserver
  alias        memserver
  address      192.168.67.30
}
define service{
  use                    generic-service
  host_name              memserver
  service_description    memcached
  check_command          check_memcached
}

define command {
  command_name    check_memcached
  command_line   ...
}
define command {
  command_name    check_memcached
  command_line    $USER1$/check_tcp 
    -H $HOSTADDRESS$ 
    -p 11211 
    -t 5
}
define command {
  command_name    check_memcached
  command_line      $USER1$/check_tcp
    -H $HOSTADDRESS$ 
    -p 11211 
    -t 5 
    -s 'statsrnquitrn' 
    -E 
    -e 'uptime' 
    -M crit
}
stats                             STAT   decr_misses 0
STAT pid 4825                     STAT   decr_hits 0
STAT uptime 7842604               STAT   cas_misses 0
STAT time 1284432055              STAT   cas_hits 0
STAT version 1.4.4                STAT   cas_badval 0
STAT pointer_size 32              STAT   auth_cmds 0
STAT rusage_user 23623.394698     STAT   auth_errors 0
STAT rusage_system 31550.652571   STAT   bytes_read 219935315170
STAT curr_connections 1243        STAT   bytes_written 788448026716
STAT total_connections 30886226   STAT   limit_maxbytes 1073741824
STAT connection_structures 1373   STAT   accepting_conns 1
STAT cmd_get 730786415            STAT   listen_disabled_num 0
STAT cmd_set 345660130            STAT   threads 4
STAT cmd_flush 0                  STAT   conn_yields 146
STAT get_hits 455135951           STAT   bytes 740742845
STAT get_misses 275650464         STAT   curr_items 3623646
STAT delete_misses 17887026       STAT   total_items 347251509
STAT delete_hits 10283848         STAT   evictions 6986784
STAT incr_misses 4281893          END
STAT incr_hits 111734935
#!/usr/local/bin/activeperl

use   strict;
use   warnings;
use   Getopt::Long;
use   IO::Socket::INET;

GetOptions(
   'H=s' => my $HOST,
   'p=s' => my $PORT,
   'k=s' => my $KEY
);

my $sock = IO::Socket::INET->new(
   PeerAddr => $HOST, PeerPort => $PORT
);
if ( !$sock ) {
    print "Couldnt connect to $HOST:$PORT: $!n";
    exit(3);
}

$sock->syswrite("get $KEYrn");
$sock->sysread( my $result, 16 );

if ( $result =~ m!^VALUE! ) {
    exit(0); #OK
}

print "Not found $KEY on $HOST:$PORTn";
exit(2);
define command {
  command_name   check_memcached
  command_line   $USER1$/check_memkey.pl
    -H $HOSTADDRESS$ 
    -p 11211 
    -k dankogai
}
$ sudo yum install net-snmp net-snmp-perl 
                   rrdtool rrdtool-perl

$   git clone git://github.com/kazeburo/cloudforecast.git
$   cd cloudforecast
$   curl -L -o cpanm http://cpanmin.us/
$   chmod u+x cpanm
$   ./cpanm -l extlib --installdeps .
#
$ cp cloudforecast_sample.yaml cloudforecast.yaml

#
$ cat server_list.yaml
--- #Memcached
servers:
 - config: memcached.yaml
   hosts:
     - 192.168.67.30 memserver memcached server
     - 192.168.67.31 memserver memcached server

#
$ cat host_config/memcached.yaml
resources:
 - traffic:eth1
 - basic
 - memcached:11211
# Web      port 5000   Listen
$ ./cloudforecast_web -p 5000 
         -c cloudforecast.yaml -l server_list.yaml


#            5
$ ./cloudforecast_radar -c cloudforecast.yaml 
                        -l server_list.yaml
STAT   1:chunk_size 80            STAT   2:cmd_set 34606948
STAT   1:chunks_per_page 13107    STAT   2:delete_hits 19083
STAT   1:total_pages 1            STAT   2:incr_hits 283422
STAT   1:total_chunks 13107       STAT   2:decr_hits 0
STAT   1:used_chunks 3            STAT   2:cas_hits 0
STAT   1:free_chunks 32           STAT   2:cas_badval 0
STAT   1:free_chunks_end 13072    ..
STAT   1:mem_requested 220        STAT   42:chunk_size 1048576
STAT   1:get_hits 4438            STAT   42:chunks_per_page 1
STAT   1:cmd_set 11998            STAT   42:total_pages 1
STAT   1:delete_hits 0            STAT   42:total_chunks 1
STAT   1:incr_hits 0              STAT   42:used_chunks 1
STAT   1:decr_hits 0              STAT   42:free_chunks 0
STAT   1:cas_hits 0               STAT   42:free_chunks_end 0
STAT   1:cas_badval 0             STAT   42:mem_requested 779480
STAT   2:chunk_size 104           STAT   42:get_hits 81
STAT   2:chunks_per_page 10082    STAT   42:cmd_set 665
STAT   2:total_pages 16           STAT   42:delete_hits 0
STAT   2:total_chunks 161312      STAT   42:incr_hits 0
STAT   2:used_chunks 116168       STAT   42:decr_hits 0
STAT   2:free_chunks 45144        STAT   42:cas_hits 0
STAT   2:free_chunks_end 0        STAT   42:cas_badval 0
STAT   2:mem_requested 11573385   STAT   active_slabs 40
STAT   2:get_hits 29690676        STAT   total_malloced 1073454184
STAT   items:1:number 3               STAT   items:3:number 1541997
STAT   items:1:age 7841268            STAT   items:3:age 6285649
STAT   items:1:evicted 0              STAT   items:3:evicted 2546432
STAT   items:1:evicted_nonzero 0      STAT   items:3:evicted_nonzero 0
STAT   items:1:evicted_time 0         STAT   items:3:evicted_time 1557089
STAT   items:1:outofmemory 0          STAT   items:3:outofmemory 0
STAT   items:1:tailrepairs 0          STAT   items:3:tailrepairs 0
STAT   items:2:number 116210          ...
STAT   items:2:age 6150456            STAT   items:42:number 1
STAT   items:2:evicted 269            STAT   items:42:age 7834430
STAT   items:2:evicted_nonzero 0      STAT   items:42:evicted 0
STAT   items:2:evicted_time 1594950   STAT   items:42:evicted_nonzero 0
STAT   items:2:outofmemory 0          STAT   items:42:evicted_time 0
STAT   items:2:tailrepairs 0          STAT   items:42:outofmemory 0
                                      STAT   items:42:tailrepairs 0
gumiStudy#2 実践 memcached
gumiStudy#2 実践 memcached
gumiStudy#2 実践 memcached
gumiStudy#2 実践 memcached

More Related Content

What's hot

UKOUG 2019 - SQL features
UKOUG 2019 - SQL featuresUKOUG 2019 - SQL features
UKOUG 2019 - SQL features
Connor McDonald
 
Sangam 19 - Analytic SQL
Sangam 19 - Analytic SQLSangam 19 - Analytic SQL
Sangam 19 - Analytic SQL
Connor McDonald
 
KScope19 - SQL Features
KScope19 - SQL FeaturesKScope19 - SQL Features
KScope19 - SQL Features
Connor McDonald
 
Sangam 19 - Successful Applications on Autonomous
Sangam 19 - Successful Applications on AutonomousSangam 19 - Successful Applications on Autonomous
Sangam 19 - Successful Applications on Autonomous
Connor McDonald
 
Flashback ITOUG
Flashback ITOUGFlashback ITOUG
Flashback ITOUG
Connor McDonald
 
Sangam 2019 - The Latest Features
Sangam 2019 - The Latest FeaturesSangam 2019 - The Latest Features
Sangam 2019 - The Latest Features
Connor McDonald
 
Saii log
Saii logSaii log
Saii log
rondk May
 
ANSI vs Oracle language
ANSI vs Oracle languageANSI vs Oracle language
ANSI vs Oracle language
Connor McDonald
 
Latin America Tour 2019 - 10 great sql features
Latin America Tour 2019  - 10 great sql featuresLatin America Tour 2019  - 10 great sql features
Latin America Tour 2019 - 10 great sql features
Connor McDonald
 
APEX Connect 2019 - array/bulk processing in PLSQL
APEX Connect 2019 - array/bulk processing in PLSQLAPEX Connect 2019 - array/bulk processing in PLSQL
APEX Connect 2019 - array/bulk processing in PLSQL
Connor McDonald
 
E-Commerce Security - Application attacks - Server Attacks
E-Commerce Security - Application attacks - Server AttacksE-Commerce Security - Application attacks - Server Attacks
E-Commerce Security - Application attacks - Server Attacks
phanleson
 
Rooted 2010 ppp
Rooted 2010 pppRooted 2010 ppp
Rooted 2010 ppp
noc_313
 
Sangam 18 - Great Applications with Great SQL
Sangam 18 - Great Applications with Great SQLSangam 18 - Great Applications with Great SQL
Sangam 18 - Great Applications with Great SQL
Connor McDonald
 
WordPress Security: Be a Superhero - WordCamp Raleigh - May 2011
WordPress Security: Be a Superhero - WordCamp Raleigh - May 2011WordPress Security: Be a Superhero - WordCamp Raleigh - May 2011
WordPress Security: Be a Superhero - WordCamp Raleigh - May 2011
John Ford
 
PGDay UK 2016 -- Performace for queries with grouping
PGDay UK 2016 -- Performace for queries with groupingPGDay UK 2016 -- Performace for queries with grouping
PGDay UK 2016 -- Performace for queries with grouping
Alexey Bashtanov
 
ROS2勉強会@別府 第7章Pythonクライアントライブラリrclpy
ROS2勉強会@別府 第7章PythonクライアントライブラリrclpyROS2勉強会@別府 第7章Pythonクライアントライブラリrclpy
ROS2勉強会@別府 第7章Pythonクライアントライブラリrclpy
Atsuki Yokota
 
Profiling of Oracle Function Calls
Profiling of Oracle Function CallsProfiling of Oracle Function Calls
Profiling of Oracle Function CallsEnkitec
 
Optimizing Queries with Explain
Optimizing Queries with ExplainOptimizing Queries with Explain
Optimizing Queries with ExplainMYXPLAIN
 

What's hot (20)

UKOUG 2019 - SQL features
UKOUG 2019 - SQL featuresUKOUG 2019 - SQL features
UKOUG 2019 - SQL features
 
Sangam 19 - Analytic SQL
Sangam 19 - Analytic SQLSangam 19 - Analytic SQL
Sangam 19 - Analytic SQL
 
KScope19 - SQL Features
KScope19 - SQL FeaturesKScope19 - SQL Features
KScope19 - SQL Features
 
Sangam 19 - Successful Applications on Autonomous
Sangam 19 - Successful Applications on AutonomousSangam 19 - Successful Applications on Autonomous
Sangam 19 - Successful Applications on Autonomous
 
Flashback ITOUG
Flashback ITOUGFlashback ITOUG
Flashback ITOUG
 
Sangam 2019 - The Latest Features
Sangam 2019 - The Latest FeaturesSangam 2019 - The Latest Features
Sangam 2019 - The Latest Features
 
Saii log
Saii logSaii log
Saii log
 
ANSI vs Oracle language
ANSI vs Oracle languageANSI vs Oracle language
ANSI vs Oracle language
 
Command
CommandCommand
Command
 
Latin America Tour 2019 - 10 great sql features
Latin America Tour 2019  - 10 great sql featuresLatin America Tour 2019  - 10 great sql features
Latin America Tour 2019 - 10 great sql features
 
APEX Connect 2019 - array/bulk processing in PLSQL
APEX Connect 2019 - array/bulk processing in PLSQLAPEX Connect 2019 - array/bulk processing in PLSQL
APEX Connect 2019 - array/bulk processing in PLSQL
 
E-Commerce Security - Application attacks - Server Attacks
E-Commerce Security - Application attacks - Server AttacksE-Commerce Security - Application attacks - Server Attacks
E-Commerce Security - Application attacks - Server Attacks
 
Rooted 2010 ppp
Rooted 2010 pppRooted 2010 ppp
Rooted 2010 ppp
 
Sangam 18 - Great Applications with Great SQL
Sangam 18 - Great Applications with Great SQLSangam 18 - Great Applications with Great SQL
Sangam 18 - Great Applications with Great SQL
 
WordPress Security: Be a Superhero - WordCamp Raleigh - May 2011
WordPress Security: Be a Superhero - WordCamp Raleigh - May 2011WordPress Security: Be a Superhero - WordCamp Raleigh - May 2011
WordPress Security: Be a Superhero - WordCamp Raleigh - May 2011
 
PGDay UK 2016 -- Performace for queries with grouping
PGDay UK 2016 -- Performace for queries with groupingPGDay UK 2016 -- Performace for queries with grouping
PGDay UK 2016 -- Performace for queries with grouping
 
ROS2勉強会@別府 第7章Pythonクライアントライブラリrclpy
ROS2勉強会@別府 第7章PythonクライアントライブラリrclpyROS2勉強会@別府 第7章Pythonクライアントライブラリrclpy
ROS2勉強会@別府 第7章Pythonクライアントライブラリrclpy
 
Profiling of Oracle Function Calls
Profiling of Oracle Function CallsProfiling of Oracle Function Calls
Profiling of Oracle Function Calls
 
Optimizing Queries with Explain
Optimizing Queries with ExplainOptimizing Queries with Explain
Optimizing Queries with Explain
 
ZFINDALLZPROGAM
ZFINDALLZPROGAMZFINDALLZPROGAM
ZFINDALLZPROGAM
 

Viewers also liked

gumiStudy#5 JavaScript でネイティブiPhone/Androidアプリを作る
gumiStudy#5 JavaScript でネイティブiPhone/Androidアプリを作るgumiStudy#5 JavaScript でネイティブiPhone/Androidアプリを作る
gumiStudy#5 JavaScript でネイティブiPhone/Androidアプリを作る
gumilab
 
gumiStudy#1 ソーシャルアプリにおけるKVSの利用事例
gumiStudy#1 ソーシャルアプリにおけるKVSの利用事例gumiStudy#1 ソーシャルアプリにおけるKVSの利用事例
gumiStudy#1 ソーシャルアプリにおけるKVSの利用事例
gumilab
 
gumiStudy#1 キーバリューストアのご紹介と利用時の設計モデルについて
gumiStudy#1 キーバリューストアのご紹介と利用時の設計モデルについてgumiStudy#1 キーバリューストアのご紹介と利用時の設計モデルについて
gumiStudy#1 キーバリューストアのご紹介と利用時の設計モデルについて
gumilab
 
gumiStudy#3 Django – 次の一歩
gumiStudy#3 Django – 次の一歩gumiStudy#3 Django – 次の一歩
gumiStudy#3 Django – 次の一歩
gumilab
 
gumiStudy#4 mixiアプリのスマートフォン版について
gumiStudy#4 mixiアプリのスマートフォン版についてgumiStudy#4 mixiアプリのスマートフォン版について
gumiStudy#4 mixiアプリのスマートフォン版について
gumilab
 
A geek's guide to getting hired
A geek's guide to getting hiredA geek's guide to getting hired
A geek's guide to getting hired
Dave Ross
 

Viewers also liked (6)

gumiStudy#5 JavaScript でネイティブiPhone/Androidアプリを作る
gumiStudy#5 JavaScript でネイティブiPhone/Androidアプリを作るgumiStudy#5 JavaScript でネイティブiPhone/Androidアプリを作る
gumiStudy#5 JavaScript でネイティブiPhone/Androidアプリを作る
 
gumiStudy#1 ソーシャルアプリにおけるKVSの利用事例
gumiStudy#1 ソーシャルアプリにおけるKVSの利用事例gumiStudy#1 ソーシャルアプリにおけるKVSの利用事例
gumiStudy#1 ソーシャルアプリにおけるKVSの利用事例
 
gumiStudy#1 キーバリューストアのご紹介と利用時の設計モデルについて
gumiStudy#1 キーバリューストアのご紹介と利用時の設計モデルについてgumiStudy#1 キーバリューストアのご紹介と利用時の設計モデルについて
gumiStudy#1 キーバリューストアのご紹介と利用時の設計モデルについて
 
gumiStudy#3 Django – 次の一歩
gumiStudy#3 Django – 次の一歩gumiStudy#3 Django – 次の一歩
gumiStudy#3 Django – 次の一歩
 
gumiStudy#4 mixiアプリのスマートフォン版について
gumiStudy#4 mixiアプリのスマートフォン版についてgumiStudy#4 mixiアプリのスマートフォン版について
gumiStudy#4 mixiアプリのスマートフォン版について
 
A geek's guide to getting hired
A geek's guide to getting hiredA geek's guide to getting hired
A geek's guide to getting hired
 

Similar to gumiStudy#2 実践 memcached

OpenWorld Sep14 12c for_developers
OpenWorld Sep14 12c for_developersOpenWorld Sep14 12c for_developers
OpenWorld Sep14 12c for_developers
Connor McDonald
 
Cpu utilization
Cpu utilizationCpu utilization
Cpu utilization
Rahimullah Hashimi
 
Debugging Ruby
Debugging RubyDebugging Ruby
Debugging Ruby
Aman Gupta
 
PFIセミナー資料 H27.10.22
PFIセミナー資料 H27.10.22PFIセミナー資料 H27.10.22
PFIセミナー資料 H27.10.22
Yuya Takei
 
Bsides
BsidesBsides
Bsides
m j
 
More Than po: Debugging in LLDB @ CocoaConf SJ 2015
More Than po: Debugging in LLDB @ CocoaConf SJ 2015More Than po: Debugging in LLDB @ CocoaConf SJ 2015
More Than po: Debugging in LLDB @ CocoaConf SJ 2015
Michele Titolo
 
Explain this!
Explain this!Explain this!
Explain this!
Fabio Telles Rodriguez
 
Troubleshooting tips and tricks for Oracle Database Oct 2020
Troubleshooting tips and tricks for Oracle Database Oct 2020Troubleshooting tips and tricks for Oracle Database Oct 2020
Troubleshooting tips and tricks for Oracle Database Oct 2020
Sandesh Rao
 
Deep dive into PostgreSQL statistics.
Deep dive into PostgreSQL statistics.Deep dive into PostgreSQL statistics.
Deep dive into PostgreSQL statistics.
Alexey Lesovsky
 
Kernel crashdump
Kernel crashdumpKernel crashdump
Kernel crashdump
Adrien Mahieux
 
Debugging Ruby Systems
Debugging Ruby SystemsDebugging Ruby Systems
Debugging Ruby Systems
Engine Yard
 
Windbg랑 친해지기
Windbg랑 친해지기Windbg랑 친해지기
Windbg랑 친해지기
Ji Hun Kim
 
metadatacoreProperties.xmlModel2015-07-13T030104Zthua3267th.docx
metadatacoreProperties.xmlModel2015-07-13T030104Zthua3267th.docxmetadatacoreProperties.xmlModel2015-07-13T030104Zthua3267th.docx
metadatacoreProperties.xmlModel2015-07-13T030104Zthua3267th.docx
ARIV4
 
Watching And Manipulating Your Network Traffic
Watching And Manipulating Your Network TrafficWatching And Manipulating Your Network Traffic
Watching And Manipulating Your Network Traffic
Josiah Ritchie
 
Aplicações 10x a 100x mais rápida com o postgre sql
Aplicações 10x a 100x mais rápida com o postgre sqlAplicações 10x a 100x mais rápida com o postgre sql
Aplicações 10x a 100x mais rápida com o postgre sql
Fabio Telles Rodriguez
 
Deep dive into PostgreSQL internal statistics / Алексей Лесовский (PostgreSQL...
Deep dive into PostgreSQL internal statistics / Алексей Лесовский (PostgreSQL...Deep dive into PostgreSQL internal statistics / Алексей Лесовский (PostgreSQL...
Deep dive into PostgreSQL internal statistics / Алексей Лесовский (PostgreSQL...
Ontico
 
Troubleshooting Tips and Tricks for Database 19c ILOUG Feb 2020
Troubleshooting Tips and Tricks for Database 19c   ILOUG Feb 2020Troubleshooting Tips and Tricks for Database 19c   ILOUG Feb 2020
Troubleshooting Tips and Tricks for Database 19c ILOUG Feb 2020
Sandesh Rao
 
12c Mini Lesson - Inline PLSQL from SQL
12c Mini Lesson - Inline PLSQL from SQL12c Mini Lesson - Inline PLSQL from SQL
12c Mini Lesson - Inline PLSQL from SQL
Connor McDonald
 
Osol Pgsql
Osol PgsqlOsol Pgsql
Osol Pgsql
Emanuel Calvo
 
Percona Live UK 2014 Part III
Percona Live UK 2014  Part IIIPercona Live UK 2014  Part III
Percona Live UK 2014 Part III
Alkin Tezuysal
 

Similar to gumiStudy#2 実践 memcached (20)

OpenWorld Sep14 12c for_developers
OpenWorld Sep14 12c for_developersOpenWorld Sep14 12c for_developers
OpenWorld Sep14 12c for_developers
 
Cpu utilization
Cpu utilizationCpu utilization
Cpu utilization
 
Debugging Ruby
Debugging RubyDebugging Ruby
Debugging Ruby
 
PFIセミナー資料 H27.10.22
PFIセミナー資料 H27.10.22PFIセミナー資料 H27.10.22
PFIセミナー資料 H27.10.22
 
Bsides
BsidesBsides
Bsides
 
More Than po: Debugging in LLDB @ CocoaConf SJ 2015
More Than po: Debugging in LLDB @ CocoaConf SJ 2015More Than po: Debugging in LLDB @ CocoaConf SJ 2015
More Than po: Debugging in LLDB @ CocoaConf SJ 2015
 
Explain this!
Explain this!Explain this!
Explain this!
 
Troubleshooting tips and tricks for Oracle Database Oct 2020
Troubleshooting tips and tricks for Oracle Database Oct 2020Troubleshooting tips and tricks for Oracle Database Oct 2020
Troubleshooting tips and tricks for Oracle Database Oct 2020
 
Deep dive into PostgreSQL statistics.
Deep dive into PostgreSQL statistics.Deep dive into PostgreSQL statistics.
Deep dive into PostgreSQL statistics.
 
Kernel crashdump
Kernel crashdumpKernel crashdump
Kernel crashdump
 
Debugging Ruby Systems
Debugging Ruby SystemsDebugging Ruby Systems
Debugging Ruby Systems
 
Windbg랑 친해지기
Windbg랑 친해지기Windbg랑 친해지기
Windbg랑 친해지기
 
metadatacoreProperties.xmlModel2015-07-13T030104Zthua3267th.docx
metadatacoreProperties.xmlModel2015-07-13T030104Zthua3267th.docxmetadatacoreProperties.xmlModel2015-07-13T030104Zthua3267th.docx
metadatacoreProperties.xmlModel2015-07-13T030104Zthua3267th.docx
 
Watching And Manipulating Your Network Traffic
Watching And Manipulating Your Network TrafficWatching And Manipulating Your Network Traffic
Watching And Manipulating Your Network Traffic
 
Aplicações 10x a 100x mais rápida com o postgre sql
Aplicações 10x a 100x mais rápida com o postgre sqlAplicações 10x a 100x mais rápida com o postgre sql
Aplicações 10x a 100x mais rápida com o postgre sql
 
Deep dive into PostgreSQL internal statistics / Алексей Лесовский (PostgreSQL...
Deep dive into PostgreSQL internal statistics / Алексей Лесовский (PostgreSQL...Deep dive into PostgreSQL internal statistics / Алексей Лесовский (PostgreSQL...
Deep dive into PostgreSQL internal statistics / Алексей Лесовский (PostgreSQL...
 
Troubleshooting Tips and Tricks for Database 19c ILOUG Feb 2020
Troubleshooting Tips and Tricks for Database 19c   ILOUG Feb 2020Troubleshooting Tips and Tricks for Database 19c   ILOUG Feb 2020
Troubleshooting Tips and Tricks for Database 19c ILOUG Feb 2020
 
12c Mini Lesson - Inline PLSQL from SQL
12c Mini Lesson - Inline PLSQL from SQL12c Mini Lesson - Inline PLSQL from SQL
12c Mini Lesson - Inline PLSQL from SQL
 
Osol Pgsql
Osol PgsqlOsol Pgsql
Osol Pgsql
 
Percona Live UK 2014 Part III
Percona Live UK 2014  Part IIIPercona Live UK 2014  Part III
Percona Live UK 2014 Part III
 

Recently uploaded

Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 

Recently uploaded (20)

Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 

gumiStudy#2 実践 memcached

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24. my $memd = Cache::Memcached::Fast->new({ servers => [qw!192.168.67.31:11211 192.168.67.32:11211!] }); if ( my $nickname = $memd->get('nickname:1') ) { return $nickname; } my $dbh = DBI->connect('DBI:mysql:boofy:host=localhost'); my $nickname = $dbh->selectrow_array( 'SELECT nickname FROM user WHERE id=?', undef, 1); if ( $nickname ) { $memd->add('nickname:1', $nickname, 24*60*60); return $nickname; } return;
  • 25. % ./memstrike -l localhost -p 11211 -t 10 -k 8 -v 8 50000 number of threads : 10 number of requests : 50000 requests per thread : 5000 get multiplex : 1 size of key : 8 bytes size of value : 8 bytes ---- [gggggggggg] ... 0.683260 sec 0.762939 MB 9.366859 Mbps 73178.585019 req/sec 13.665200 usec/req
  • 26.
  • 27. VS
  • 28. VS
  • 29.
  • 30.
  • 31. memcached ×
  • 32.
  • 33.
  • 34.
  • 35.
  • 36. % sudo ./memcached -c 262144 -u nobody
  • 37. 4532 int maxfiles = settings.maxconns; 4533 if (rlim.rlim_cur < maxfiles) 4534 rlim.rlim_cur = maxfiles; 4535 if (rlim.rlim_max < rlim.rlim_cur) 4536 rlim.rlim_max = rlim.rlim_cur; 4537 if (setrlimit(RLIMIT_NOFILE, &rlim) != 0) { 4538 fprintf(stderr, "failed to set rlimit for open files. Try running as root or requesting smaller maxconns value.n"); 4539 exit(EX_OSERR); 4540 }
  • 38.
  • 39. % ./memcached -l 127.0.0.1 % ./memcached -l 192.168.67.31
  • 40. % ./memcached -l 192.168.67.31 .. % ssh myserver % telnet localhost 11211 Trying ::1... Trying 127.0.0.1... telnet: Unable to connect to remote host: Connection refused
  • 41. % sudo ./memcached -c 262144 -u nobody
  • 42.
  • 43. % ./memcached -vvv slab class 1: chunk size 96 perslab 10922 slab class 40: chunk size 1048576 perslab 1 <26 server listening (auto-negotiate) <27 server listening (auto-negotiate) <28 send buffer was 124928, now 268435456 <28 server listening (udp) <28 server listening (udp) <28 server listening (udp) <28 server listening (udp) <29 send buffer was 124928, now 268435456 <29 server listening (udp) <29 server listening (udp) <29 server listening (udp) <29 server listening (udp)
  • 44. % ./memcached -p 11211 -U 0
  • 45. % ./memcached -U 0 % ./memcached -U 12345
  • 48. % ./memcached -c 32768 -u nobody -C -m 16G -p 11211 -U 0
  • 49. % telnet localhost 11211 Trying ::1... Connected to localhost. Escape character is '^]'. stats settings STAT maxbytes 16777216 STAT maxconns 32768 STAT tcpport 11211 STAT udpport 0 STAT inter NULL STAT verbosity 0 STAT oldest 0 STAT evictions on STAT growth_factor 1.25 STAT chunk_size 48 STAT num_threads 4 STAT cas_enabled no STAT tcp_backlog 4096 STAT binding_protocol auto-negotiate STAT auth_enabled_sasl no STAT item_size_max 1048576 END
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58. define host{ use generic-host host_name memserver alias memserver address 192.168.67.30 } define service{ use generic-service host_name memserver service_description memcached check_command check_memcached } define command { command_name check_memcached command_line ... }
  • 59. define command { command_name check_memcached command_line $USER1$/check_tcp -H $HOSTADDRESS$ -p 11211 -t 5 }
  • 60. define command { command_name check_memcached command_line $USER1$/check_tcp -H $HOSTADDRESS$ -p 11211 -t 5 -s 'statsrnquitrn' -E -e 'uptime' -M crit }
  • 61. stats STAT decr_misses 0 STAT pid 4825 STAT decr_hits 0 STAT uptime 7842604 STAT cas_misses 0 STAT time 1284432055 STAT cas_hits 0 STAT version 1.4.4 STAT cas_badval 0 STAT pointer_size 32 STAT auth_cmds 0 STAT rusage_user 23623.394698 STAT auth_errors 0 STAT rusage_system 31550.652571 STAT bytes_read 219935315170 STAT curr_connections 1243 STAT bytes_written 788448026716 STAT total_connections 30886226 STAT limit_maxbytes 1073741824 STAT connection_structures 1373 STAT accepting_conns 1 STAT cmd_get 730786415 STAT listen_disabled_num 0 STAT cmd_set 345660130 STAT threads 4 STAT cmd_flush 0 STAT conn_yields 146 STAT get_hits 455135951 STAT bytes 740742845 STAT get_misses 275650464 STAT curr_items 3623646 STAT delete_misses 17887026 STAT total_items 347251509 STAT delete_hits 10283848 STAT evictions 6986784 STAT incr_misses 4281893 END STAT incr_hits 111734935
  • 62.
  • 63.
  • 64. #!/usr/local/bin/activeperl use strict; use warnings; use Getopt::Long; use IO::Socket::INET; GetOptions( 'H=s' => my $HOST, 'p=s' => my $PORT, 'k=s' => my $KEY ); my $sock = IO::Socket::INET->new( PeerAddr => $HOST, PeerPort => $PORT ); if ( !$sock ) { print "Couldnt connect to $HOST:$PORT: $!n"; exit(3); } $sock->syswrite("get $KEYrn"); $sock->sysread( my $result, 16 ); if ( $result =~ m!^VALUE! ) { exit(0); #OK } print "Not found $KEY on $HOST:$PORTn"; exit(2);
  • 65. define command { command_name check_memcached command_line $USER1$/check_memkey.pl -H $HOSTADDRESS$ -p 11211 -k dankogai }
  • 66.
  • 67.
  • 68.
  • 69. $ sudo yum install net-snmp net-snmp-perl rrdtool rrdtool-perl $ git clone git://github.com/kazeburo/cloudforecast.git $ cd cloudforecast $ curl -L -o cpanm http://cpanmin.us/ $ chmod u+x cpanm $ ./cpanm -l extlib --installdeps .
  • 70. # $ cp cloudforecast_sample.yaml cloudforecast.yaml # $ cat server_list.yaml --- #Memcached servers: - config: memcached.yaml hosts: - 192.168.67.30 memserver memcached server - 192.168.67.31 memserver memcached server # $ cat host_config/memcached.yaml resources: - traffic:eth1 - basic - memcached:11211
  • 71. # Web port 5000 Listen $ ./cloudforecast_web -p 5000 -c cloudforecast.yaml -l server_list.yaml # 5 $ ./cloudforecast_radar -c cloudforecast.yaml -l server_list.yaml
  • 72.
  • 73.
  • 74.
  • 75.
  • 76.
  • 77.
  • 78.
  • 79. STAT 1:chunk_size 80 STAT 2:cmd_set 34606948 STAT 1:chunks_per_page 13107 STAT 2:delete_hits 19083 STAT 1:total_pages 1 STAT 2:incr_hits 283422 STAT 1:total_chunks 13107 STAT 2:decr_hits 0 STAT 1:used_chunks 3 STAT 2:cas_hits 0 STAT 1:free_chunks 32 STAT 2:cas_badval 0 STAT 1:free_chunks_end 13072 .. STAT 1:mem_requested 220 STAT 42:chunk_size 1048576 STAT 1:get_hits 4438 STAT 42:chunks_per_page 1 STAT 1:cmd_set 11998 STAT 42:total_pages 1 STAT 1:delete_hits 0 STAT 42:total_chunks 1 STAT 1:incr_hits 0 STAT 42:used_chunks 1 STAT 1:decr_hits 0 STAT 42:free_chunks 0 STAT 1:cas_hits 0 STAT 42:free_chunks_end 0 STAT 1:cas_badval 0 STAT 42:mem_requested 779480 STAT 2:chunk_size 104 STAT 42:get_hits 81 STAT 2:chunks_per_page 10082 STAT 42:cmd_set 665 STAT 2:total_pages 16 STAT 42:delete_hits 0 STAT 2:total_chunks 161312 STAT 42:incr_hits 0 STAT 2:used_chunks 116168 STAT 42:decr_hits 0 STAT 2:free_chunks 45144 STAT 42:cas_hits 0 STAT 2:free_chunks_end 0 STAT 42:cas_badval 0 STAT 2:mem_requested 11573385 STAT active_slabs 40 STAT 2:get_hits 29690676 STAT total_malloced 1073454184
  • 80. STAT items:1:number 3 STAT items:3:number 1541997 STAT items:1:age 7841268 STAT items:3:age 6285649 STAT items:1:evicted 0 STAT items:3:evicted 2546432 STAT items:1:evicted_nonzero 0 STAT items:3:evicted_nonzero 0 STAT items:1:evicted_time 0 STAT items:3:evicted_time 1557089 STAT items:1:outofmemory 0 STAT items:3:outofmemory 0 STAT items:1:tailrepairs 0 STAT items:3:tailrepairs 0 STAT items:2:number 116210 ... STAT items:2:age 6150456 STAT items:42:number 1 STAT items:2:evicted 269 STAT items:42:age 7834430 STAT items:2:evicted_nonzero 0 STAT items:42:evicted 0 STAT items:2:evicted_time 1594950 STAT items:42:evicted_nonzero 0 STAT items:2:outofmemory 0 STAT items:42:evicted_time 0 STAT items:2:tailrepairs 0 STAT items:42:outofmemory 0 STAT items:42:tailrepairs 0

Editor's Notes