www.skypicker.comMám 20€ a chcem ísť do Londýna!
Čo to robí?•   Search engine•   Booking engine•   UX•   Customer support•   Magic & Science
Obrázok stacku            BookingData                    Payment/penaze             Search
== predávame letenky, takto
Tech• Javascript, everywhere (CanJS)    – yeoman, node, grunt, bower, testacular•   Python•   MongoDB & Redis•   Celery & ...
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...
uWSGi features•   performance•   funguje všade (nginx, apache…)•   multiprotocol (uwsgi, http, whatever)•   shared memory•...
Performance•   Throughput (req/sec)•   Danke - http://blog.kgriffs.com
Config Nginxupstream uwsgicluster        {           server 127.0.0.1:9999;           server 127.0.0.1:10000 backup=1;    ...
uWSGI config[uwsgi]socket = 127.0.0.1:9999master = true                        #master procesprocesses = 5harakiri = 20   ...
Shared memory - Py/home/virtualenv/bin/uwsgi -s :3033 --pyshell --cache 1000*** Cache subsystem initialized: 64MB (key: 20...
Shared memory - perfo252015                                                  Py dict10                                    ...
Shared mem : Redisfrom datetime import datetime                                    80:1opak = 10000start = datetime.now()f...
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/muta...
Logging v uWSGI• oddelenie error/access logov• Mongo, Redis, ZeroMQ, network, Graphite• Alert system• Do budúcna Sentry/Ai...
Top prusers v SP• TSP• Optimalizácia memory/sorted sets v Redise• uWSGI 1.9 :)
Konec• jk@skypicker.com• www.skypicker.com
Upcoming SlideShare
Loading in...5
×

Jk rubyslava 25

1,833

Published on

Published in: Travel
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,833
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Jk rubyslava 25

  1. 1. www.skypicker.comMám 20€ a chcem ísť do Londýna!
  2. 2. Čo to robí?• Search engine• Booking engine• UX• Customer support• Magic & Science
  3. 3. Obrázok stacku BookingData Payment/penaze Search
  4. 4. == predávame letenky, takto
  5. 5. Tech• Javascript, everywhere (CanJS) – yeoman, node, grunt, bower, testacular• Python• MongoDB & Redis• Celery & uWSGI• Nginx & MySQL & stuff• Trello & Apiary
  6. 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. 7. uWSGi features• performance• funguje všade (nginx, apache…)• multiprotocol (uwsgi, http, whatever)• shared memory• zerg• management workerov• pluginy
  8. 8. Performance• Throughput (req/sec)• Danke - http://blog.kgriffs.com
  9. 9. Config Nginxupstream 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. 10. uWSGI config[uwsgi]socket = 127.0.0.1:9999master = true #master procesprocesses = 5harakiri = 20 #max 20s na dotazmax-requests=15 #max req na 1 proceslimit-as=500 #max memory na 1 procesmemory-report=truecarbon = 127.0.0.1:2003 #graphitefile = lietadlo.pydaemonize = lietadlo.logtouch-reload = lietadlo.py
  11. 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 3import uwsgiuwsgi.cache_set("foo_key1", "foo_value")key = uwsgi.cache_get("foo_key")from redis import Redisredis = 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. 12. Shared memory - perfo252015 Py dict10 uWSGI Redis 5 0 Get request Spotreba ram pre 10 procesov
  13. 13. Shared mem : Redisfrom datetime import datetime 80:1opak = 10000start = datetime.now()for x in range(opak): key=uwsgi.cache_get("foo_key")print datetime.now()-start0:00:00.006963start = datetime.now()for x in range(opak): key = redis.get("foo_key")print datetime.now()-start0:00:00.545974start = datetime.now()for x in range(opak): key = d["foo_key "]print datetime.now()-start0:00:00.003890
  14. 14. Zerg mode• Realtime pridanie workerov• Škálovanie• Test deployment
  15. 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 --modulewelcomeuwsgi --pause main.pid#Naskočí zerg… shit shit shituwsgi --resume main.piduwsgi --stop test.pid
  16. 16. Logging v uWSGI• oddelenie error/access logov• Mongo, Redis, ZeroMQ, network, Graphite• Alert system• Do budúcna Sentry/Airbrake (uWSGI 1.9)
  17. 17. Top prusers v SP• TSP• Optimalizácia memory/sorted sets v Redise• uWSGI 1.9 :)
  18. 18. Konec• jk@skypicker.com• www.skypicker.com

×