Abstract
This chapter establishes guidelines and rules of thumb for designing and implementing APIs with a special focus on performance and maintainability. The majority of the techniques described here can be used to address and—if applied at design time—avoid performance degradation, while others can help to optimize overall service-related implementation and support costs.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
Note that repeatedly running inexpensive queries can at times be justified if the equivalent SQL query involving a joining of tables turns out to be more expensive. As always, make sure you measure the impact of both options before deciding which approach to take.
- 2.
Often, such SLAs are only loosely expressed, and—unless the service dependencies are all internal to your company—unenforceable. If you cannot coerce the team owning the dependency to meet their SLAs, then moving to alternative sources, or caching results (discussed later) might be your only options.
- 3.
Main gperftools repository: https://github.com/gperftools/gperftools
- 4.
“Analysis of algorithms,” Wikipedia. https://en.wikipedia.org/wiki/Analysis_of_algorithms
- 5.
Sarah Ervin, “The Real Cost of Logging”, 17 April 2014. https://dzone.com/articles/real-cost-logging
- 6.
Ian Malpass, “Measure Anything, Measure Everything”, 15 February 2011. https://codeascraft.com/2011/02/15/measure-anything-measure-everything/
- 7.
Peter Dikant, “Storing log messages in Hadoop”, 15 April 2010. http://blog.mgm-tp.com/2010/04/hadoop-log-management-part2/
- 8.
“Master/slave (technology)”, Wikopedia, https://en.wikipedia.org/wiki/Master/slave_(technology )
- 9.
Sam Newman, “Pattern: Backends For Frontends”, 18 November 2015; http://samnewman.io/patterns/architectural/bff/
- 10.
- 11.
- 12.
Sean Work, “How Loading Time Affects Your Bottom Line”, April 2011; https://blog.kissmetrics.com/loading-time/
- 13.
“List of HTTP header fields”, Wikipedia; http://en.wikipedia.org/wiki/List_of_HTTP_header_fields
- 14.
“MD5”, Wikipedia; https://en.wikipedia.org/wiki/MD5
- 15.
Mac Developer Library, “About the URL Loading System”, https://developer.apple.com/library/mac/#documentation/cocoa/conceptual/urlloadingsystem/urlloadingsystem.html
- 16.
Google Calendar API documentation, “Partial response”, https://developers.google.com/google-apps/calendar/performance#partial-response
- 17.
“HTTP compression”, Wikipedia; http://en.wikipedia.org/wiki/HTTP_compression
- 18.
Java Platform Standard Edition 8 Documentation, “Class GZIPOutputStream.” https://docs.oracle.com/javase/8/docs/api/java/util/zip/GZIPOutputStream.html
- 19.
RubyDoc, “Class: Rack::Deflater”; http://www.rubydoc.info/github/rack/rack/master/Rack/Deflater
- 20.
“What is HATEOAS and why is it important for my REST API?” The REST CookBook. http://restcookbook.com/Basics/hateoas/
- 21.
M. Kelly, “JSON Hypertext Application Language”, 3 October 2013; https://tools.ietf.org/html/draft-kelly-json-hal-06
- 22.
This should not be taken as an invitation to neglect resource efficiency when implementing functionality in a service! You don't want to have long-running service code make clients wait and tie up resources, which might cause client-side circuit breakers to trip, or worse make them entirely unresponsive.
- 23.
Gregor Hohpe, Bobby Woolf: Enterprise Integration Patterns: Designing, Building, and Deploying Messaging Solutions. Addison-Wesley Professional 2003.
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2016 Cloves Carneiro Jr. and Tim Schmelmer
About this chapter
Cite this chapter
Carneiro, C., Schmelmer, T. (2016). Optimizing Your APIs. In: Microservices From Day One. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-1937-9_7
Download citation
DOI: https://doi.org/10.1007/978-1-4842-1937-9_7
Published:
Publisher Name: Apress, Berkeley, CA
Print ISBN: 978-1-4842-1936-2
Online ISBN: 978-1-4842-1937-9
eBook Packages: Professional and Applied ComputingProfessional and Applied Computing (R0)Apress Access Books