• Save
Jk rubyslava 25
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Jk rubyslava 25

on

  • 2,219 views

 

Statistics

Views

Total Views
2,219
Views on SlideShare
2,137
Embed Views
82

Actions

Likes
0
Downloads
0
Comments
0

1 Embed 82

http://lanyrd.com 82

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Jk rubyslava 25 Presentation Transcript

  • 1. www.skypicker.comMá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 BookingData Payment/penaze Search
  • 4. == predávame letenky, takto
  • 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 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. 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. 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. Shared memory - perfo252015 Py dict10 uWSGI Redis 5 0 Get request Spotreba ram pre 10 procesov
  • 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. 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 --modulewelcomeuwsgi --pause main.pid#Naskočí zerg… shit shit shituwsgi --resume main.piduwsgi --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 :)
  • 18. Konec• jk@skypicker.com• www.skypicker.com