• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Session Control  @ nolinux day
 

Session Control @ nolinux day

on

  • 526 views

How to implement a session control system scalable and reliable with an open source stack.

How to implement a session control system scalable and reliable with an open source stack.

Statistics

Views

Total Views
526
Views on SlideShare
515
Embed Views
11

Actions

Likes
3
Downloads
5
Comments
0

2 Embeds 11

http://www.linkedin.com 8
https://www.linkedin.com 3

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

CC Attribution-NonCommercial LicenseCC Attribution-NonCommercial License

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

    Session Control  @ nolinux day Session Control @ nolinux day Presentation Transcript

    • SimultaneousAccessControlwith a full open source stackWalter Traspadini@uollter
    • non conventional architecture (?)why redis ?why flask ?
    • Redis.ioSalvatore Sanfilippo@antirezSponsored byOpen Sourcekey-value storeno-sql ?((made in italy)
    • Who is using Redis
    • Redis.iokeys can expiremaster-slavein memory datasetpersistenceData Structure- String- Integer (mainly for counting)- List- Set- Ordered set- Hash stored list
    • Dont do this !!rs = redis.Redis()rs.keys(*)- time complexity O(n)- 10^6 keys database in 40 msec.- IT MAY RUIN PERFORMANCES
    • Best practicesSADD SERVICES [QOL, S24, PROF]HSET SERVICE:QOL expire 60HSET SERVICE:QOL max_count 1HSET SERVICE:QOL:bob max_count 3ZADD ACTIVITY:QOL:bob:20121010 14:50 Login 1450ZADD ACTIVITY:QOL:bob:20121010 15:15 Logout 1515ZRANGE ACTIVITY:QOL:bob:20121010 1200, 1600 O(log(N) + M)(N: # of elements in the sorted set. M: # of element returned)listobjectsscores
    • Flask> micro-framework for python> builtin server> RESTful request dispatching> WSGI compliant> integrated support for unit testing
    • ...... easy .....code example@app.route(/logout/<username>/<service>/<label> , methods=[GET])@jsonp.jsonpdef logout(username, service, label, device_type=None):user.sessions = g.r_server.get(USER:%s:%s:%s %(username, service, label)))if user.sessions and int(user.sessions) > 0:g.r_server.delete(user.key())return jsonify({user: user.to_json(), error: messages.OK_NO_ERROR})return jsonify({error: messages.NOT_LOGGEDIN_ERROR, user: user.to_json()})
    • ..... siac .... api ...../chack_access/EntroBol04/QOL/<fingerprint>MMMD5 ( browser capabilities+browser plugins )cf4ceeb4398b80132eeceadea0a2f9ee/logout/EntroBol04/QOL/<fingerprint>
    • headache> does redis scale ?> which is the failover policy ?> what about clustering ?
    • my early prototype .......SIACREDISMASTERREDISSLAVE
    • spreecast http://www.spreecast.com/
    • Apache ZooKeeperCentralized service for maintaining:configuration information,naming,distributed synchronization
    • .. the final solution .. <3 productionRedisRedis RedisSIAC SIACZooKeeperCluster MonitorMonitorRedis Redis
    • redis_failover ... for python ...https://github.com/uolter/redis_failover
    • ....share the code Luke ....
    • continuous integration as a service
    • want to learn more ....> Redis: http://redis.io> Video redis: http://vimeo.com/21539227> Flask: http://flask.pocoo.org> Spreecast & Redis Failover: http://engineering.speecast.com/spreecast-redis-failover> ZooKeeper: http://zookeeper.apache.org
    • Walter Traspadinihttp://bit.ly/uolter@uollter