High Performance Session Checks

229 views

Published on

Published in: Technology
1 Comment
1 Like
Statistics
Notes
No Downloads
Views
Total views
229
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
4
Comments
1
Likes
1
Embeds 0
No embeds

No notes for slide

High Performance Session Checks

  1. 1. HIGH PERFORMANCE SESSION CHECKS Mikael Lindström Schibsted Payment
  2. 2. WHAT IS OUR SESSION CHECKS?     Javascript SDK send a session check request SPiD backend extracts the cookie Fetches session, client and user objects from MongoDB Business logic validates the session and checks that the client has access to the user  Updates the session timestamp in MongoDB  Returns some json data in a jsonp container
  3. 3. OLD IMPLEMENTATION  PHP - implementation  MongoDB – sessions and clients
  4. 4. PROBLEM  Our PHP implementation does a lot of bootstrapping  Loads and initiates unnecessary functionality for each request  Huge amount of requests to this specific endpoint becomes a bottleneck  Potentially called for each pageview on our clients.
  5. 5. NEW IMPLEMENTATION  Nginx – ssl termination  Node.js – implementation  MongoDB – sessions and clients
  6. 6. TEST MACHINE     HP gen 8 blade 14 node worker processes 14 nginx processes MongoDB session database  Testing using LoadImpact (loadimpact.com)
  7. 7. RESULTS  20 minutes  7 million requests  36 cups of coffee
  8. 8. PROBLEMS     Reading PHP sessions in node is hard Cluster module unstable Callback hell Some modules we used was a bit unstable
  9. 9. CONCLUSION  Solution was more complex than we initially thought. We could have benefitted from a framework.  Callbacks vs promises and yields  Huge performance increase  Bottleneck today is Nginx (ssl termination)  ssl termination in Load Balancer
  10. 10. QUESTIONS?

×