Your SlideShare is downloading. ×
0
Scaling with swagger
Scaling with swagger
Scaling with swagger
Scaling with swagger
Scaling with swagger
Scaling with swagger
Scaling with swagger
Scaling with swagger
Scaling with swagger
Scaling with swagger
Scaling with swagger
Scaling with swagger
Scaling with swagger
Scaling with swagger
Scaling with swagger
Scaling with swagger
Scaling with swagger
Scaling with swagger
Scaling with swagger
Scaling with swagger
Scaling with swagger
Scaling with swagger
Scaling with swagger
Scaling with swagger
Scaling with swagger
Scaling with swagger
Scaling with swagger
Scaling with swagger
Scaling with swagger
Scaling with swagger
Scaling with swagger
Scaling with swagger
Scaling with swagger
Scaling with swagger
Scaling with swagger
Scaling with swagger
Scaling with swagger
Scaling with swagger
Scaling with swagger
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Scaling with swagger

7,208

Published on

Ways you can scale your software and organization with Wordnik's Swagger framework

Ways you can scale your software and organization with Wordnik's Swagger framework

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

No Downloads
Views
Total Views
7,208
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
53
Comments
0
Likes
15
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Scaling with Swagger Tony Tam @fehguy
  • 2. Scaling is the Developers JobWas:• Write code, make it work• If it get slow, buy: • Bigger server • Bigger database • "Enterprise" software support
  • 3. Needs Harmony Between• Software• Data Tier• Development Infrastructure• Deployment Infrastructure• Team• Ability to manage it all
  • 4. Needs Harmony Between• Software• Data Tier• Development Infrastructure• Deployment Infrastructure• Team• Ability to manage it Best Achieved all with Good Architecture
  • 5. BackgroundBizTier Data Tier DBA "Bee n
  • 6. Common Mistakes…• "Lets organize by horizontal!"• "Back end shouldnt care what front end does!"• "Just get it launched and well scale with hardware"• "You can scale transparently with technology X"• "Get an Oracle consultant to speed things up"
  • 7. Common Problems• Overly complicated interfaces • Abstracted too many times • "We can switch out entities with a simple configuration!"• Over-abstracted • "We might need to change database vendors so abstract the SQL layer"• Over designed • "We dont know how the client will call, so support all possible calls!"
  • 8. Solutions• Many Possible • Some suck, some good• Lets look at Wordnik
  • 9. Directionally Speaking• Go Vertical! • Ability to understand full lifecycle • APIs as the communication of choice • General convergence on developers • Databases (MongoDB, Cassandra, Dynamo) • API frameworks• IT & QA are disappearing • Wordnik currently has *none* • Team, infrastructure, discipline *win*
  • 10. Directionally Speaking• Go Vertical! • Ability to understand full lifecycle • APIs as the communication of choice • General convergence on developers Still Room • Databases (MongoDB, Cassandra, Dynamo) to specialize • API frameworks• IT & QA are disappearing • Wordnik currently has *none* • Team, infrastructure, discipline *win*
  • 11. Vertical, Explained• Big application => micro servicesMonolithicapplication "Isnt this just SOA?"
  • 12. Not SOA• This is different • No proprietary message bus • Decoupled objects • Dedicated storage***• Speak REST • Develop your services in… • Java • Scala • Ruby • Php
  • 13. Speak REST?• Sounds good but… • REST semantics vary wildly • HATEOAS vs. practical REST?/api/pet.json/1?delete (GET)/api/pet.json/1 (DELETE) All/api/pet.json/1 (POST empty) valid!So…
  • 14. Speak REST?• Sounds good but… • REST semantics vary wildly • HATEOAS vs. practical REST?/api/pet.json/1?delete (GET) Peer All/api/pet.json/1 (DELETE) Review! valid!/api/pet.json/1 (POST empty) Better Docs!So… API API Styleguide Council! !
  • 15. Hello, Swagger• Swagger is… • Spec for declaring an API schema • A framework for auto-generating the spec • A library for client library generation • A JSON-based test framework
  • 16. What is this Resource Declaration?• Listing of all available APIshttp://petstore.swagger.wordnik.com/api/resources.json “It’s like a sitemap for your API!”
  • 17. What is this Resource Declaration?• “But I don’t want it all exposed!” • Swagger can filter APIs by permissions Header, Api key, URL, Cookies, Method OAuth
  • 18. What is this Resource Declaration?• Each api is documentedhttp://petstore.swagger.wordnik.com/api/pet.json
  • 19. API Documentation Highlights• Describes • Operations • Models• Permission-based filtering• JSON and XML supported
  • 20. Anatomy of API Documentation
  • 21. Anatomy of API Documentation Based on JSON Schema (Draft)http://tools.ietf.org/html/draft-zyp-json-schema-03
  • 22. API Parameters
  • 23. API Parameters• Filtering on parameters• Enumerated options w/optional default
  • 24. API Parameters
  • 25. How does this help?• Generate client libs• Invoke methods not URLs• Pass arguments, not query params• Dont care about how service is developed • Different versions of java? • Different REST frameworks?
  • 26. How does this help?• Generate client libs• Invoke methods not URLs• Pass arguments, not query params• DontRESTler? how service is developed care about JAX-RS • Different versions of java? • Different REST frameworks? Client Play! Scalatra doesnt care
  • 27. Example Codegen./bin/generate-scala-lib.sh http://petstore.swagger.wordnik.com/api "" "com.wordnik" client
  • 28. Example InvocationScala Ruby
  • 29. But What about Speed?• Yes! REST over HTTP is slow • Connection overhead • Marshaling & Unmarshaling overhead • Chatter • JSON/XML need to diet• Its also… • Synchronous • GET/POST/PUT/DELETE dont cut it
  • 30. But What about Speed?• Yes! REST over HTTP is slow • Connection overhead • Your Marshaling & Unmarshaling overhead prod • Chatter Database • JSON/XML need to diet isnt doing• Its also… REST • Synchronous • GET/POST/PUT/DELETE dont cut it
  • 31. Websockets to the Rescue!• Its… • Full Duplex • Persistent connections • Completely Async• But… • Very finicky • Wildly inconsistent server support • Still in draft
  • 32. Websockets to the Rescue!• Its… • Full Duplex • Persistent connections • Completely Async• But… • Very finicky • Wildly inconsistent server support • Still in draft
  • 33. Abstracted by Atmospherehttps://github.com/Atmosphere/atmosphere• Fully Sponsored by Wordnik• Abstracts the mess• Support on many containers• Client fallback/draft protocol support
  • 34. Abstracted by Atmospherehttps://github.com/Atmosphere/atmosphere• Fully Sponsored by Wordnik• Abstracts the mess• Support on many containers• Client fallback/draft protocolTomcat support Weblogi Jetty c JBoss Resin Netty Glassfis h
  • 35. Swagger + Websockets• Swagger sockets • Same discovery interface • Same client interface • Same codegen• But… • Multiplexed connections • Support for binary protocol • Full Async • Adding "subscribe" to GET/POST/PUT/DELETE
  • 36. Swagger Sockets• Live now on smartmoney.com• Fully OSS• Wire-protocol speed• Format-agnostic • JSON • Binary
  • 37. Summary• Smaller, dedicated units of work• Micro services => micro teams• Full service knowledge• Swagger is the Fabric for your Services• Swagger sockets are like Fiber for your grids connectivity
  • 38. See More…• http://swagger.wordnik.com/• https://github.com/wordnik/swagger-core• https://github.com/wordnik/swagger-ui• https://github.com/wordnik/wordnik-oss
  • 39. Questions?

×