SlideShare a Scribd company logo
1 of 18
www.skypicker.com
Mám 20€ a chcem ísť do Londýna!
Čo to robí?

•   Search engine
•   Booking engine
•   UX
•   Customer support
•   Magic & Science
Obrázok stacku

            Booking




Data                    Payment/penaze




             Search
== predávame letenky, takto
Tech
• Javascript, everywhere (CanJS)
    – yeoman, node, grunt, bower, testacular
•   Python
•   MongoDB & Redis
•   Celery & uWSGI
•   Nginx & MySQL & stuff

• Trello & Apiary
uWSGI
• uwsgi/wsgi vs uWSGI
• wsgi = slabšie http pre py
  – PEP 333 a 3333


• uWSGI – lepítko medzi web fw a nginx

• čo Tornado/Diesel?
uWSGi features
•   performance
•   funguje všade (nginx, apache…)
•   multiprotocol (uwsgi, http, whatever)
•   shared memory
•   zerg
•   management workerov
•   pluginy
Performance
•   Throughput (req/sec)




•   Danke - http://blog.kgriffs.com
Config Nginx
upstream uwsgicluster        {
           server 127.0.0.1:9999;
           server 127.0.0.1:10000 backup=1;
         }



server   {
         location /images {
                     root /var/www/obrazky;
                    }

         location /lietadla {
                    include uwsgi_params;
                    uwsgi_pass uwsgicluster;
                    uwsgi_read_timeout 60; uwsgi_connect_timeout 60;
                    }
         }
uWSGI config
[uwsgi]
socket = 127.0.0.1:9999
master = true                        #master proces
processes = 5
harakiri = 20                         #max 20s na dotaz
max-requests=15              #max req na 1 proces
limit-as=500                          #max memory na 1 proces
memory-report=true
carbon = 127.0.0.1:2003              #graphite
file = lietadlo.py
daemonize = lietadlo.log
touch-reload = lietadlo.py
Shared memory - Py
/home/virtualenv/bin/uwsgi -s :3033 --pyshell --cache 1000
*** Cache subsystem initialized: 64MB (key: 2096 bytes, keys: 2096000 bytes, data:
65536000 bytes) preallocated ***
uwsgi socket 0 bound to TCP address :3033 fd 3
import uwsgi
uwsgi.cache_set("foo_key1", "foo_value")
key = uwsgi.cache_get("foo_key")
from redis import Redis
redis = Redis(unix_socket_path="/var/run/redis/redis.sock", db = 7)
redis.set("foo_key","foo_value")
key = redis.get("foo_key")

d = {}
d["foo_key "] = "foo_value"
key = d["foo_key "]
Shared memory - perfo
25


20


15
                                                  Py dict
10                                                uWSGI
                                                  Redis
 5


 0
     Get request   Spotreba ram pre 10 procesov
Shared mem : Redis
from datetime import datetime
                                    80:1
opak = 10000
start = datetime.now()
for x in range(opak):
              key=uwsgi.cache_get("foo_key")

print datetime.now()-start
0:00:00.006963

start = datetime.now()
for x in range(opak):
              key = redis.get("foo_key")

print datetime.now()-start
0:00:00.545974

start = datetime.now()
for x in range(opak):
              key = d["foo_key "]

print datetime.now()-start
0:00:00.003890
Zerg mode
• Realtime pridanie workerov

• Škálovanie

• Test deployment
Zerg deploy
./uwsgi –M –p 8 --pidfile main.pid --module welcome --zerg-server /var/run/mutalisk

./uwsgi --zerg /var/run/mutalisk --pidfile test.pid s--master --processes 4 --module
welcome

uwsgi --pause main.pid

#Naskočí zerg… shit shit shit

uwsgi --resume main.pid
uwsgi --stop test.pid
Logging v uWSGI
• oddelenie error/access logov

• Mongo, Redis, ZeroMQ, network, Graphite

• Alert system

• Do budúcna Sentry/Airbrake (uWSGI 1.9)
Top prusers v SP
• TSP

• Optimalizácia memory/sorted sets v Redise

• uWSGI 1.9 :)
Konec


• jk@skypicker.com

• www.skypicker.com

More Related Content

What's hot

Openstack at NTT Feb 7, 2011
Openstack at NTT Feb 7, 2011Openstack at NTT Feb 7, 2011
Openstack at NTT Feb 7, 2011
Open Stack
 
高性能かつスケールアウト可能なHPCクラウド AIST Super Green Cloud
高性能かつスケールアウト可能なHPCクラウド AIST Super Green Cloud高性能かつスケールアウト可能なHPCクラウド AIST Super Green Cloud
高性能かつスケールアウト可能なHPCクラウド AIST Super Green Cloud
Ryousei Takano
 

What's hot (19)

Nodejs - Should Ruby Developers Care?
Nodejs - Should Ruby Developers Care?Nodejs - Should Ruby Developers Care?
Nodejs - Should Ruby Developers Care?
 
Node.js - As a networking tool
Node.js - As a networking toolNode.js - As a networking tool
Node.js - As a networking tool
 
Dirty - How simple is your database?
Dirty - How simple is your database?Dirty - How simple is your database?
Dirty - How simple is your database?
 
Node.js - A practical introduction (v2)
Node.js  - A practical introduction (v2)Node.js  - A practical introduction (v2)
Node.js - A practical introduction (v2)
 
Nodejs - A quick tour (v4)
Nodejs - A quick tour (v4)Nodejs - A quick tour (v4)
Nodejs - A quick tour (v4)
 
Presentation of JSConf.eu
Presentation of JSConf.euPresentation of JSConf.eu
Presentation of JSConf.eu
 
Openstack at NTT Feb 7, 2011
Openstack at NTT Feb 7, 2011Openstack at NTT Feb 7, 2011
Openstack at NTT Feb 7, 2011
 
Mysqlnd uh
Mysqlnd uhMysqlnd uh
Mysqlnd uh
 
Nodejs - A quick tour (v5)
Nodejs - A quick tour (v5)Nodejs - A quick tour (v5)
Nodejs - A quick tour (v5)
 
Ender
EnderEnder
Ender
 
高性能かつスケールアウト可能なHPCクラウド AIST Super Green Cloud
高性能かつスケールアウト可能なHPCクラウド AIST Super Green Cloud高性能かつスケールアウト可能なHPCクラウド AIST Super Green Cloud
高性能かつスケールアウト可能なHPCクラウド AIST Super Green Cloud
 
Масштабируемая конфигурация Nginx, Игорь Сысоев (Nginx)
Масштабируемая конфигурация Nginx, Игорь Сысоев (Nginx)Масштабируемая конфигурация Nginx, Игорь Сысоев (Nginx)
Масштабируемая конфигурация Nginx, Игорь Сысоев (Nginx)
 
HBaseCon 2013: OpenTSDB at Box
HBaseCon 2013: OpenTSDB at BoxHBaseCon 2013: OpenTSDB at Box
HBaseCon 2013: OpenTSDB at Box
 
2 docker engine_hands_on
2 docker engine_hands_on2 docker engine_hands_on
2 docker engine_hands_on
 
"Metrics: Where and How", Vsevolod Polyakov
"Metrics: Where and How", Vsevolod Polyakov"Metrics: Where and How", Vsevolod Polyakov
"Metrics: Where and How", Vsevolod Polyakov
 
Node.js - A Quick Tour II
Node.js - A Quick Tour IINode.js - A Quick Tour II
Node.js - A Quick Tour II
 
Go Memory
Go MemoryGo Memory
Go Memory
 
Ac cuda c_1
Ac cuda c_1Ac cuda c_1
Ac cuda c_1
 
Best Practices in Handling Performance Issues
Best Practices in Handling Performance IssuesBest Practices in Handling Performance Issues
Best Practices in Handling Performance Issues
 

Similar to Jk rubyslava 25

fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
Wesley Beary
 
Deployment with Fabric
Deployment with FabricDeployment with Fabric
Deployment with Fabric
andymccurdy
 
Beyond Golden Containers: Complementing Docker with Puppet
Beyond Golden Containers: Complementing Docker with PuppetBeyond Golden Containers: Complementing Docker with Puppet
Beyond Golden Containers: Complementing Docker with Puppet
lutter
 
Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applications
Tom Croucher
 
Virtualization and automation of library software/machines + Puppet
Virtualization and automation of library software/machines + PuppetVirtualization and automation of library software/machines + Puppet
Virtualization and automation of library software/machines + Puppet
Omar Reygaert
 

Similar to Jk rubyslava 25 (20)

fog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the Cloudfog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the Cloud
 
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
 
How we use and deploy Varnish at Opera
How we use and deploy Varnish at OperaHow we use and deploy Varnish at Opera
How we use and deploy Varnish at Opera
 
Real World Lessons on the Pain Points of Node.js Applications
Real World Lessons on the Pain Points of Node.js ApplicationsReal World Lessons on the Pain Points of Node.js Applications
Real World Lessons on the Pain Points of Node.js Applications
 
Building and Scaling Node.js Applications
Building and Scaling Node.js ApplicationsBuilding and Scaling Node.js Applications
Building and Scaling Node.js Applications
 
Monitoring MySQL with OpenTSDB
Monitoring MySQL with OpenTSDBMonitoring MySQL with OpenTSDB
Monitoring MySQL with OpenTSDB
 
DUG'20: 12 - DAOS in Lenovo’s HPC Innovation Center
DUG'20: 12 - DAOS in Lenovo’s HPC Innovation CenterDUG'20: 12 - DAOS in Lenovo’s HPC Innovation Center
DUG'20: 12 - DAOS in Lenovo’s HPC Innovation Center
 
Future Decoded - Node.js per sviluppatori .NET
Future Decoded - Node.js per sviluppatori .NETFuture Decoded - Node.js per sviluppatori .NET
Future Decoded - Node.js per sviluppatori .NET
 
"Swoole: double troubles in c", Alexandr Vronskiy
"Swoole: double troubles in c", Alexandr Vronskiy"Swoole: double troubles in c", Alexandr Vronskiy
"Swoole: double troubles in c", Alexandr Vronskiy
 
Non-blocking I/O, Event loops and node.js
Non-blocking I/O, Event loops and node.jsNon-blocking I/O, Event loops and node.js
Non-blocking I/O, Event loops and node.js
 
Deployment with Fabric
Deployment with FabricDeployment with Fabric
Deployment with Fabric
 
Salesforce at Stacki Atlanta Meetup February 2016
Salesforce at Stacki Atlanta Meetup February 2016Salesforce at Stacki Atlanta Meetup February 2016
Salesforce at Stacki Atlanta Meetup February 2016
 
Automating Complex Setups with Puppet
Automating Complex Setups with PuppetAutomating Complex Setups with Puppet
Automating Complex Setups with Puppet
 
How Secure Are Docker Containers?
How Secure Are Docker Containers?How Secure Are Docker Containers?
How Secure Are Docker Containers?
 
Beyond Golden Containers: Complementing Docker with Puppet
Beyond Golden Containers: Complementing Docker with PuppetBeyond Golden Containers: Complementing Docker with Puppet
Beyond Golden Containers: Complementing Docker with Puppet
 
Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applications
 
node.js - Eventful JavaScript on the Server
node.js - Eventful JavaScript on the Servernode.js - Eventful JavaScript on the Server
node.js - Eventful JavaScript on the Server
 
Automating complex infrastructures with Puppet
Automating complex infrastructures with PuppetAutomating complex infrastructures with Puppet
Automating complex infrastructures with Puppet
 
CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak
CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak   CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak
CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak
 
Virtualization and automation of library software/machines + Puppet
Virtualization and automation of library software/machines + PuppetVirtualization and automation of library software/machines + Puppet
Virtualization and automation of library software/machines + Puppet
 

Recently uploaded

sample sample sample sample sample sample
sample sample sample sample sample samplesample sample sample sample sample sample
sample sample sample sample sample sample
Casey Keith
 
sample sample sample sample sample sample
sample sample sample sample sample samplesample sample sample sample sample sample
sample sample sample sample sample sample
Casey Keith
 
Sample sample sample sample sample sample
Sample sample sample sample sample sampleSample sample sample sample sample sample
Sample sample sample sample sample sample
Casey Keith
 
🔥HOT🔥📲9602870969🔥Prostitute Service in Udaipur Call Girls in City Palace Lake...
🔥HOT🔥📲9602870969🔥Prostitute Service in Udaipur Call Girls in City Palace Lake...🔥HOT🔥📲9602870969🔥Prostitute Service in Udaipur Call Girls in City Palace Lake...
🔥HOT🔥📲9602870969🔥Prostitute Service in Udaipur Call Girls in City Palace Lake...
Apsara Of India
 
sample sample sample sample sample sample
sample sample sample sample sample samplesample sample sample sample sample sample
sample sample sample sample sample sample
Casey Keith
 

Recently uploaded (20)

Ooty Call Girls 8250077686 Service Offer VIP Hot Model
Ooty Call Girls 8250077686 Service Offer VIP Hot ModelOoty Call Girls 8250077686 Service Offer VIP Hot Model
Ooty Call Girls 8250077686 Service Offer VIP Hot Model
 
Genuine 8250077686 Hot and Beautiful 💕 Bhavnagar Escorts call Girls
Genuine 8250077686 Hot and Beautiful 💕 Bhavnagar Escorts call GirlsGenuine 8250077686 Hot and Beautiful 💕 Bhavnagar Escorts call Girls
Genuine 8250077686 Hot and Beautiful 💕 Bhavnagar Escorts call Girls
 
❤Personal Contact Number Mcleodganj Call Girls 8617697112💦✅.
❤Personal Contact Number Mcleodganj Call Girls 8617697112💦✅.❤Personal Contact Number Mcleodganj Call Girls 8617697112💦✅.
❤Personal Contact Number Mcleodganj Call Girls 8617697112💦✅.
 
Ooty call girls 📞 8617697112 At Low Cost Cash Payment Booking
Ooty call girls 📞 8617697112 At Low Cost Cash Payment BookingOoty call girls 📞 8617697112 At Low Cost Cash Payment Booking
Ooty call girls 📞 8617697112 At Low Cost Cash Payment Booking
 
sample sample sample sample sample sample
sample sample sample sample sample samplesample sample sample sample sample sample
sample sample sample sample sample sample
 
Tamluk ❤CALL GIRL 8617697112 ❤CALL GIRLS IN Tamluk ESCORT SERVICE❤CALL GIRL
Tamluk ❤CALL GIRL 8617697112 ❤CALL GIRLS IN Tamluk ESCORT SERVICE❤CALL GIRLTamluk ❤CALL GIRL 8617697112 ❤CALL GIRLS IN Tamluk ESCORT SERVICE❤CALL GIRL
Tamluk ❤CALL GIRL 8617697112 ❤CALL GIRLS IN Tamluk ESCORT SERVICE❤CALL GIRL
 
sample sample sample sample sample sample
sample sample sample sample sample samplesample sample sample sample sample sample
sample sample sample sample sample sample
 
Sample sample sample sample sample sample
Sample sample sample sample sample sampleSample sample sample sample sample sample
Sample sample sample sample sample sample
 
Genuine 8250077686 Hot and Beautiful 💕 Visakhapatnam Escorts call Girls
Genuine 8250077686 Hot and Beautiful 💕 Visakhapatnam Escorts call GirlsGenuine 8250077686 Hot and Beautiful 💕 Visakhapatnam Escorts call Girls
Genuine 8250077686 Hot and Beautiful 💕 Visakhapatnam Escorts call Girls
 
🔥HOT🔥📲9602870969🔥Prostitute Service in Udaipur Call Girls in City Palace Lake...
🔥HOT🔥📲9602870969🔥Prostitute Service in Udaipur Call Girls in City Palace Lake...🔥HOT🔥📲9602870969🔥Prostitute Service in Udaipur Call Girls in City Palace Lake...
🔥HOT🔥📲9602870969🔥Prostitute Service in Udaipur Call Girls in City Palace Lake...
 
Genuine 8250077686 Hot and Beautiful 💕 Chennai Escorts call Girls
Genuine 8250077686 Hot and Beautiful 💕 Chennai Escorts call GirlsGenuine 8250077686 Hot and Beautiful 💕 Chennai Escorts call Girls
Genuine 8250077686 Hot and Beautiful 💕 Chennai Escorts call Girls
 
Hire 💕 8617697112 Surat Call Girls Service Call Girls Agency
Hire 💕 8617697112 Surat Call Girls Service Call Girls AgencyHire 💕 8617697112 Surat Call Girls Service Call Girls Agency
Hire 💕 8617697112 Surat Call Girls Service Call Girls Agency
 
Discover Mathura And Vrindavan A Spritual Journey.pdf
Discover Mathura And Vrindavan A Spritual Journey.pdfDiscover Mathura And Vrindavan A Spritual Journey.pdf
Discover Mathura And Vrindavan A Spritual Journey.pdf
 
WhatsApp Chat: 📞 8617697112 Suri Call Girls available for hotel room package
WhatsApp Chat: 📞 8617697112 Suri Call Girls available for hotel room packageWhatsApp Chat: 📞 8617697112 Suri Call Girls available for hotel room package
WhatsApp Chat: 📞 8617697112 Suri Call Girls available for hotel room package
 
Siliguri Call Girls 8250077686 Service Offer VIP Hot Model
Siliguri Call Girls 8250077686 Service Offer VIP Hot ModelSiliguri Call Girls 8250077686 Service Offer VIP Hot Model
Siliguri Call Girls 8250077686 Service Offer VIP Hot Model
 
❤Personal Contact Number Varanasi Call Girls 8617697112💦✅.
❤Personal Contact Number Varanasi Call Girls 8617697112💦✅.❤Personal Contact Number Varanasi Call Girls 8617697112💦✅.
❤Personal Contact Number Varanasi Call Girls 8617697112💦✅.
 
Papi kondalu Call Girls 8250077686 Service Offer VIP Hot Model
Papi kondalu Call Girls 8250077686 Service Offer VIP Hot ModelPapi kondalu Call Girls 8250077686 Service Offer VIP Hot Model
Papi kondalu Call Girls 8250077686 Service Offer VIP Hot Model
 
Andheri East Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Andheri East Call Girls 🥰 8617370543 Service Offer VIP Hot ModelAndheri East Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Andheri East Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
sample sample sample sample sample sample
sample sample sample sample sample samplesample sample sample sample sample sample
sample sample sample sample sample sample
 
ITALY - Visa Options for expats and digital nomads
ITALY - Visa Options for expats and digital nomadsITALY - Visa Options for expats and digital nomads
ITALY - Visa Options for expats and digital nomads
 

Jk rubyslava 25

  • 1. www.skypicker.com Mám 20€ a chcem ísť do Londýna!
  • 2. Čo to robí? • Search engine • Booking engine • UX • Customer support • Magic & Science
  • 3. Obrázok stacku Booking Data Payment/penaze Search
  • 5. Tech • Javascript, everywhere (CanJS) – yeoman, node, grunt, bower, testacular • Python • MongoDB & Redis • Celery & uWSGI • Nginx & MySQL & stuff • Trello & Apiary
  • 6. uWSGI • uwsgi/wsgi vs uWSGI • wsgi = slabšie http pre py – PEP 333 a 3333 • uWSGI – lepítko medzi web fw a nginx • čo Tornado/Diesel?
  • 7. uWSGi features • performance • funguje všade (nginx, apache…) • multiprotocol (uwsgi, http, whatever) • shared memory • zerg • management workerov • pluginy
  • 8. Performance • Throughput (req/sec) • Danke - http://blog.kgriffs.com
  • 9. Config Nginx upstream uwsgicluster { server 127.0.0.1:9999; server 127.0.0.1:10000 backup=1; } server { location /images { root /var/www/obrazky; } location /lietadla { include uwsgi_params; uwsgi_pass uwsgicluster; uwsgi_read_timeout 60; uwsgi_connect_timeout 60; } }
  • 10. uWSGI config [uwsgi] socket = 127.0.0.1:9999 master = true #master proces processes = 5 harakiri = 20 #max 20s na dotaz max-requests=15 #max req na 1 proces limit-as=500 #max memory na 1 proces memory-report=true carbon = 127.0.0.1:2003 #graphite file = lietadlo.py daemonize = lietadlo.log touch-reload = lietadlo.py
  • 11. Shared memory - Py /home/virtualenv/bin/uwsgi -s :3033 --pyshell --cache 1000 *** Cache subsystem initialized: 64MB (key: 2096 bytes, keys: 2096000 bytes, data: 65536000 bytes) preallocated *** uwsgi socket 0 bound to TCP address :3033 fd 3 import uwsgi uwsgi.cache_set("foo_key1", "foo_value") key = uwsgi.cache_get("foo_key") from redis import Redis redis = Redis(unix_socket_path="/var/run/redis/redis.sock", db = 7) redis.set("foo_key","foo_value") key = redis.get("foo_key") d = {} d["foo_key "] = "foo_value" key = d["foo_key "]
  • 12. Shared memory - perfo 25 20 15 Py dict 10 uWSGI Redis 5 0 Get request Spotreba ram pre 10 procesov
  • 13. Shared mem : Redis from datetime import datetime 80:1 opak = 10000 start = datetime.now() for x in range(opak): key=uwsgi.cache_get("foo_key") print datetime.now()-start 0:00:00.006963 start = datetime.now() for x in range(opak): key = redis.get("foo_key") print datetime.now()-start 0:00:00.545974 start = datetime.now() for x in range(opak): key = d["foo_key "] print datetime.now()-start 0:00:00.003890
  • 14. Zerg mode • Realtime pridanie workerov • Škálovanie • Test deployment
  • 15. Zerg deploy ./uwsgi –M –p 8 --pidfile main.pid --module welcome --zerg-server /var/run/mutalisk ./uwsgi --zerg /var/run/mutalisk --pidfile test.pid s--master --processes 4 --module welcome uwsgi --pause main.pid #Naskočí zerg… shit shit shit uwsgi --resume main.pid uwsgi --stop test.pid
  • 16. Logging v uWSGI • oddelenie error/access logov • Mongo, Redis, ZeroMQ, network, Graphite • Alert system • Do budúcna Sentry/Airbrake (uWSGI 1.9)
  • 17. Top prusers v SP • TSP • Optimalizácia memory/sorted sets v Redise • uWSGI 1.9 :)