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

Jk rubyslava 25

on

  • 2,199 views

 

Statistics

Views

Total Views
2,199
Views on SlideShare
2,117
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 Jk rubyslava 25 Presentation Transcript

  • 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• 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 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; } }
  • 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
  • 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 "]
  • Shared memory - perfo252015 Py dict10 uWSGI Redis 5 0 Get request Spotreba ram pre 10 procesov
  • 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
  • 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 --modulewelcomeuwsgi --pause main.pid#Naskočí zerg… shit shit shituwsgi --resume main.piduwsgi --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