9 points · by arthurcolle · 11y ago · 9 comments
I have seen the words before, but things like memcached, HAProxy, etc - I didn't appreciate why they were useful until I saw the limits of a simple server + db combo.
I was wondering, besides the following:
http server (WEBRick or Puma, Apache)
database + database server (MySQL, postgres, etc)
Load balancer (HAProxy)
Caching middleware (memcached)
Sessions (Redis)
What are other major components of web apps that are critical for building high performance apps?
Thanks in advance!
- Use a CDN to serve static content without the need to serve the content out of the origin server every request.
- Create instances of your application in multiple regions. The shortest path to your web app varies based on where the user is in the world. Multiple regions can minimize the latency introduced via the hops s/he must make.
Personally I like varnish for this role.
If it's a Rails app, two things spring to mind as first things to try once you have profiling in place:
- lower the number of web server workers and/or threads (depending on what you're using)
- Ruby 2.1's garbage collector is really not well suited to web apps because it will often promote objects from a single request to the long-lived generation, even though they will not be needed again. Going from 2.0 to 2.1 nearly doubled the memory usage of one of our apps. 2.2 is doing much better.
You might also want to see if you can offload any processing of tasks that can be queued using something like Sidekick or Resque.
There's a bunch of other things you could do but you really need to work out why your app isn't performing as you'd like first.
I'll definitely check out Data Dog and New Relic, thanks for the tip