Scaling Telephony
with Python:The
Plivo Learnings
Nishad Musthafa
Plivo Inc
Saturday, July 6, 13
About me
• First engineer at Plivo
• Dig open source
• Zen of python
• twitter.com/_nishad
Saturday, July 6, 13
Plivo Open Source
github.com/plivo/plivoframework/
ESL
Saturday, July 6, 13
How does plivo work?
• Plivo gets a call.
• Plivo needs to know what to do ?
• Plivo uses a callback like http://
customer...
Initial setup
Media Server
DB
Customer
API calls
Callbacks
Saturday, July 6, 13
Issues with this setup
• Business logic vs Telephony
• Code updates
• Scaling Issues
Saturday, July 6, 13
Solution
Media Server
DBCustomer
API calls
Callbacks
Django
Saturday, July 6, 13
Did that solve it?
Yes
Did we go ahead and
use it?
Not quiet.
Saturday, July 6, 13
There are still issues
• Performance issues with Django
• Security issues
Saturday, July 6, 13
Enter proxy
• A lightweight proxy server written in flask
• This acts as both an in and out proxy
• Has the goodness of gev...
Solution
Media Server
DB
Customer
API calls
Proxy
DjangoCallbacks
Saturday, July 6, 13
So far so good
• Added a django based UI for our existing
customers to add and manipulate their user
related data.
• There...
New Customer Alert!!
• We had a new customer who urgently
needed a bunch of api’s ready in a week to
migrate a large numbe...
Tasty Pie to the rescue
• Tasty pie from toast driven is an excellent
framework to create an API from your
django models.W...
Piston is lacking
• /Account/id/Subaccount/
• /Account/subaccountid/
• The above two are apis on the same model
• Piston d...
Tasty Pie Basics
Resource
Retrieve List
Retrieve Detail
Saturday, July 6, 13
Tasty Pie Basics
Create
Update
Delete
Saturday, July 6, 13
Tasty Pie Best Practices
• Derive ModelResource to create a
Resource type that’s specific to your use
case. Eg: Error retur...
Speedups
• Johnny Cache
• Django celery
Saturday, July 6, 13
One week later
Saturday, July 6, 13
Questions anyone?
Saturday, July 6, 13
Thank you!!
Saturday, July 6, 13
Upcoming SlideShare
Loading in …5
×

Scaling telephony

1,247 views
1,194 views

Published on

My Talk at Pycon

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

  • Be the first to like this

No Downloads
Views
Total views
1,247
On SlideShare
0
From Embeds
0
Number of Embeds
461
Actions
Shares
0
Downloads
14
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Scaling telephony

  1. 1. Scaling Telephony with Python:The Plivo Learnings Nishad Musthafa Plivo Inc Saturday, July 6, 13
  2. 2. About me • First engineer at Plivo • Dig open source • Zen of python • twitter.com/_nishad Saturday, July 6, 13
  3. 3. Plivo Open Source github.com/plivo/plivoframework/ ESL Saturday, July 6, 13
  4. 4. How does plivo work? • Plivo gets a call. • Plivo needs to know what to do ? • Plivo uses a callback like http:// customercallback.com/ Saturday, July 6, 13
  5. 5. Initial setup Media Server DB Customer API calls Callbacks Saturday, July 6, 13
  6. 6. Issues with this setup • Business logic vs Telephony • Code updates • Scaling Issues Saturday, July 6, 13
  7. 7. Solution Media Server DBCustomer API calls Callbacks Django Saturday, July 6, 13
  8. 8. Did that solve it? Yes Did we go ahead and use it? Not quiet. Saturday, July 6, 13
  9. 9. There are still issues • Performance issues with Django • Security issues Saturday, July 6, 13
  10. 10. Enter proxy • A lightweight proxy server written in flask • This acts as both an in and out proxy • Has the goodness of gevent Saturday, July 6, 13
  11. 11. Solution Media Server DB Customer API calls Proxy DjangoCallbacks Saturday, July 6, 13
  12. 12. So far so good • Added a django based UI for our existing customers to add and manipulate their user related data. • There was no current need for an api for manipulation of these data or so we thought. Saturday, July 6, 13
  13. 13. New Customer Alert!! • We had a new customer who urgently needed a bunch of api’s ready in a week to migrate a large number of minutes to our platform. • We didn’t have any API’s • We had one week. It wasn’t a friendly mail. It was an ultimatum Saturday, July 6, 13
  14. 14. Tasty Pie to the rescue • Tasty pie from toast driven is an excellent framework to create an API from your django models.We also did evaluate piston. But there were basic issues there. Saturday, July 6, 13
  15. 15. Piston is lacking • /Account/id/Subaccount/ • /Account/subaccountid/ • The above two are apis on the same model • Piston doesn’t let you do this. Saturday, July 6, 13
  16. 16. Tasty Pie Basics Resource Retrieve List Retrieve Detail Saturday, July 6, 13
  17. 17. Tasty Pie Basics Create Update Delete Saturday, July 6, 13
  18. 18. Tasty Pie Best Practices • Derive ModelResource to create a Resource type that’s specific to your use case. Eg: Error returning. • Dehydrate: Use the Resource’s dehydrate function to add data that isn’t available in the models. Eg: cost as a sum of 2 fields • Filters:The build_filters function allows you specify filters based on fields of models. Be careful using them. Saturday, July 6, 13
  19. 19. Speedups • Johnny Cache • Django celery Saturday, July 6, 13
  20. 20. One week later Saturday, July 6, 13
  21. 21. Questions anyone? Saturday, July 6, 13
  22. 22. Thank you!! Saturday, July 6, 13

×