Skip to main content

Optimizing Your APIs

  • Chapter
  • First Online:
Microservices From Day One

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 49.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 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. 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. 3.

    Main gperftools repository: https://github.com/gperftools/gperftools

  4. 4.

    “Analysis of algorithms,” Wikipedia. https://en.wikipedia.org/wiki/Analysis_of_algorithms

  5. 5.

    Sarah Ervin, “The Real Cost of Logging”, 17 April 2014. https://dzone.com/articles/real-cost-logging

  6. 6.

    Ian Malpass, “Measure Anything, Measure Everything”, 15 February 2011. https://codeascraft.com/2011/02/15/measure-anything-measure-everything/

  7. 7.

    Peter Dikant, “Storing log messages in Hadoop”, 15 April 2010. http://blog.mgm-tp.com/2010/04/hadoop-log-management-part2/

  8. 8.

    “Master/slave (technology)”, Wikopedia, https://en.wikipedia.org/wiki/Master/slave_(technology )

  9. 9.

    Sam Newman, “Pattern: Backends For Frontends”, 18 November 2015; http://samnewman.io/patterns/architectural/bff/

  10. 10.

    https://memcached.org/

  11. 11.

    http://redis.io/

  12. 12.

    Sean Work, “How Loading Time Affects Your Bottom Line”, April 2011; https://blog.kissmetrics.com/loading-time/

  13. 13.

    “List of HTTP header fields”, Wikipedia; http://en.wikipedia.org/wiki/List_of_HTTP_header_fields

  14. 14.

    “MD5”, Wikipedia; https://en.wikipedia.org/wiki/MD5

  15. 15.

    Mac Developer Library, “About the URL Loading System”, https://developer.apple.com/library/mac/#documentation/cocoa/conceptual/urlloadingsystem/urlloadingsystem.html

  16. 16.

    Google Calendar API documentation, “Partial response”, https://developers.google.com/google-apps/calendar/performance#partial-response

  17. 17.

    “HTTP compression”, Wikipedia; http://en.wikipedia.org/wiki/HTTP_compression

  18. 18.

    Java Platform Standard Edition 8 Documentation, “Class GZIPOutputStream.” https://docs.oracle.com/javase/8/docs/api/java/util/zip/GZIPOutputStream.html

  19. 19.

    RubyDoc, “Class: Rack::Deflater”; http://www.rubydoc.info/github/rack/rack/master/Rack/Deflater

  20. 20.

    “What is HATEOAS and why is it important for my REST API?” The REST CookBook. http://restcookbook.com/Basics/hateoas/

  21. 21.

    M. Kelly, “JSON Hypertext Application Language”, 3 October 2013; https://tools.ietf.org/html/draft-kelly-json-hal-06

  22. 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. 23.

    Gregor Hohpe, Bobby Woolf: Enterprise Integration Patterns: Designing, Building, and Deploying Messaging Solutions. Addison-Wesley Professional 2003.

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints 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

Publish with us

Policies and ethics