About me
✦ TatsuhikoKubo(bokko@pixiv.com)
✦ @cubicdaiya(twitter, github)
✦ Senior Software Engineer@pixiv Inc.
13年9月20日金曜日
3.
Recent Work
✦ mruby_nginx_module
✦Embedded mruby into Nginx
✦ ngx_small_light
✦ Dynamic Image Transformation for Nginx
✦ Contributions/pull requests to many other
projects on github
13年9月20日金曜日
4.
Recent Work
WEB+DB PRESSVol.72
□detailed nginx
flexible configuration
and
brilliant scalability
□collaborators
@harukasan
@semind
13年9月20日金曜日
Problems
✦ data synchronizationis straining
✦ TCP connection overhead
✦ processing time is directly proprtional the
number of APs
✦ data restoration is painful
✦ memcached is not persistent
✦ e.g, when AP server goes down.
13年9月20日金曜日
18.
Migration to KyotoTycoon
✦KyotoTycoon supports
✦ data persistency.
✦ data expiration
✦ memcached ASCII protocol.
✦ We could migrate without modifying application!
13年9月20日金曜日
KyotoTycoon overwhelmed
✦ KyotoTycoon(usingmemcached protocol plugin)
compared with memcached,
✦ Lower performance
Even so, persistency is some good!
We wanted it at that time!
13年9月20日金曜日
dealing with theseproblems
✦ Scale out(For example, add servers)
✦ This was difficult for us at least at that time...
✦ Scale up(For example, buy expensive servers)
✦ This was more difficult for us.
✦ Use proxy server!
✦ Actually, I developed one in C.
✦ Twemproxy was not released yet.
13年9月20日金曜日
26.
✦ Scale out(Forexample, add servers)
✦ This was difficult for us at least at that time...
✦ Scale up(For example, buy expensive servers)
✦ This was more difficult for us.
✦ Use proxy server!
✦ Actually, I developed one in C.
✦ Twemproxy was not released yet.
dealing with these problems
13年9月20日金曜日
single-master and multipleworkers
✦ Master is responsible for
✦ controlling worker processes
✦ Workers are responsible for
✦ processing user’s requests
✦ Supervisor may control only Master
✦ Now we use Monit instead of daemontools
13年9月20日金曜日
“ctl” block
sockpath socketpath for controlling neoagent
logpath log path for master process
"ctl" : {
"sockpath" : "/var/run/neoagent_ctl.sock",
"logpath" : "/var/run/neoagent_ctl.log",
},
This block is for master
13年9月20日金曜日
“environments” block
✦ Inneoagent,
✦ environment is the configuration for workers.
✦ Each entry in “environments” is the configuration for
each worker.
✦ Master manages workers for each of their of
environments.
13年9月20日金曜日
53.
“environments” block
name environmentname
sockpath socket path for communicating neoagent’s worker
target_server primary memcached server
backup_server secondary memcached server
conn_max max connections(backlog size)
connpool_max connection pool size
etc...
document is here
http://cubicdaiya.github.io/neoagent/
13年9月20日金曜日
Master’s threads
✦ sigwait-thread
✦waiting for a signal from ctl-
thread
✦ ctl-thread
✦ receiving a instruction from
neoctl through ctl-socket
13年9月20日金曜日
57.
Worker’s threads
✦ sigwait-thread
✦waiting for a signal from ctl-
thread
✦ event-threads
✦ processing client requests
✦ support-thread
✦ health-checking & statictics
13年9月20日金曜日
SCons
✦ Simple &flexible & programable build tool
✦ Auto anaylysis of dependencies
✦ Build-configuration is written with Python
✦ Suitable for small or medium scale projects
13年9月20日金曜日
Problem with signals
✦complicated & easy to mistake
✦ must send multiple signals to master
and workers at a time
✦ must link worker’s PID to neoagent’s
environment
13年9月20日金曜日
neoctl internal
✦ neoctlsends instructions to master
✦ by UNIX domain socket
✦ master manages worker’ PIDs
✦ and the link between each worker’s PID and
environment name, too.
✦ master sends signals master-self and workers.
13年9月20日金曜日