// I need to

ModernizeUpgrade without breaking it RescueFix what someone else started Build NewTurn an idea into a product Reach More PeopleGet found, get used, include everyone

// Company

Case StudiesExpertiseAbout + CareersResourcesContact Book a call →

Performance Tuning All SSL Webapps

SSL handshakes add latency to every connection. Practical reminders for reducing the performance cost of an all SSL webapp, starting with keep-alive.

Art+Logic Jun 7, 20132 min read

From the Art+Logic archive · written in 2013. The tools may have moved on; the thinking still holds.

image of Legos

Image from LoozrBoy

In my last post, I talked about the benefits of going all SSL for a webapp.  There were plenty of benefits, not the least of which was securing your users’ data.  However, there still exists that one pesky drawback that prevents most of us from using SSL more often…performance.

There’s no denying that SSL has overhead.  The handshaking that happens between a client and server requires 2 complete roundtrips to complete before HTTP can take over.  For connections with a lot of latency, this can add up quickly.  In the future, I’m sure we’ll see better performing security protocols, and the gap between secure and non-secure requests will be dramatically reduced.  For now, we’re stuck with what’s available.  So as developers, what can we do to reduce the impact all ssl webapps?  Here are a few reminders:

  1. Use Persistent Connections

    Setting the Connection: keep-alive header will allow the browser to keep a connection open, bypassing the SSL handshaking for subsequent requests.  Given that the handshake consists of 2 full roundtrips, anytime this can be skipped without comprising security is good.

  2. Cache Content

    Allow infrequently changing content to be cached locally by the client.  Use cache control headers wisely.

  3. Spritify

    If you’ve got a bunch of small icons on your site, consider combining them into a single image sprite.  Obviously, reducing 10 calls for images down to a single call will have a nice performance boost.  Not only are you avoiding the SSL handshake, but you only endure the network latency once.

  4. Minify

    Consider combining and minifying your javascript and css files.  Again, it’s all about reducing the number of requests needed to render your page.  Here’s a link to a more in-depth look a minification.

  5. Compression

    The processing power required to decrypt responses from the server depends on the size of the data to decrypt.  The less data, the less time and effort is needed to decrypt it.  Plus, you don’t have to send as much data over the wire.  Win Win.

  6. Use CDNs or Caching Proxies for Static Content

    Offload static payload to other servers so your application server doesn’t have to waste CPU cycles.  Technically, this falls under the category of reducing the work my server has to do, rather than reducing the overall work that has to be done.  But shoot, if those CDNs will help us out, then all the better.  If your application server doesn’t have to mess around with those pesky static files, then your app will be quicker to respond.

    Keep in mind that unless your user base is geographically diverse, a CDN is probably overkill.  You’ll have to put up with long TTLs while the changes propagate, with no apparent gain.  In this case, a caching proxy is probably a better fit.

Again, this isn’t anything new.  Although we’re talking about performance tuning within the context of an all SSL site, these really are just general webapp tuning principles.  The name of the game is reducing requests, reducing data, and utlimately, reducing time.

keep going

More to explore in Build New.

All Build New resources →
let's talk

Got a problem like this one?

Tell us what's stuck. A real person replies within one business day.

Talk to our team →

Talk to people who know software, not a sales script.

Your first call is with Aja, our VP of Sales. He'll help make sure you're solving the right problem. Here's what you'll cover together:

  1. What you're trying to accomplish

    The business goal first, then the technology.

  2. Possible approaches

    And the tradeoffs of each, in plain language.

  3. Risks you may not have considered

    Technical and business, before they cost you.

  4. Whether AI changes the math

    What's practical, and what's just hype for your project.

  5. Sensible next steps

    Even if the right next step is not us.

book-a-call.ics

Loading the scheduler…

Open the booking page →

Some problems are easier to explain in writing. Send us a few lines about what you're working on, and we'll reply within one business day. Helpful to include:

  1. What the software does, or should do
  2. What's stuck, or what's worrying you
  3. Any deadline or budget you have in mind
note.md

Loading the form…