0

I built a redirections management service - Redirecto where I am managing redirections for clients by nginx config files alone.

I would like to benchmark my service in terms of speed & load it can handle, since it's just nginx & not even static files 😇

I tried using $request_time in a custom log format & tried using that, but its always logged as 0.000.

I am thinking I need a load testing tool, that doesn't follow redirects. Any suggestions?

4
  • Interesting architecture, given Nginx needs to be reloaded when there's a config change, which would be frequent. I assume you've benchmarked Nginx with millions of redirections installed? I'd probably have gone with a scripting language (PHP?) and MySQL, and you could add caching later if required. Nginx will be so fast it effectively takes 0 time. You can try ab (Apache Benchmark) or JMeter as a testing tool, you'll have to do some research to work out if either are suitable.
    – Tim
    Sep 28, 2017 at 20:15
  • @Tim Thanks! I have a cron script that runs every minute, which check for a file-exists kinda flag & reload nginx config when needed. I haven't benchmarked a big deal, hence this post for stress testing the service. I have roughly collected the redirection speed using a tool serp-perception.com/redirect-speed-tester.php but I need to do better benchmarking.
    – Ashfame
    Sep 28, 2017 at 20:19
  • Sure. Try those tools. Have a script add a million redirects and see what happens. Check what happens when Nginx is being reloaded, and how long that reload takes.
    – Tim
    Sep 28, 2017 at 20:38
  • Good idea on stress testing it on a data level as well. For now, I am more than happy with results I got from ab.
    – Ashfame
    Sep 28, 2017 at 20:51

1 Answer 1

0

I was able to use Apache Benchmark (ab) for my benchmarking as it doesn't follow redirects by default.

ab -n 10000 -c 10 https://example.com/

Percentage of the requests served within a certain time (ms) 50% 36 66% 39 75% 40 80% 42 90% 46 95% 51 98% 57 99% 62 100% 113 (longest request)

ab -n 10000 -c 100 https://example.com/

Percentage of the requests served within a certain time (ms) 50% 374 66% 381 75% 388 80% 394 90% 417 95% 430 98% 456 99% 509 100% 577 (longest request)

That's 259M+ hits in a month worth of traffic. Pretty happy with the results.

5
  • That's a lot of latency, but that could be explained if you have a large ping to the server. I'd test from another server in the same location - in AWS I'd spin up a spot instance. I'd also really suggest that you need to do this benchmarking with a large number of redirects, the number that you'd expect to have in a year or two.
    – Tim
    Sep 28, 2017 at 21:52
  • @Tim You think network latency is adding up a big margin in these numbers? And it should actually be faster? And I totally hear you on the stressing by data part. Just not upto the task right away.
    – Ashfame
    Sep 28, 2017 at 21:55
  • Second thought, 36ms at 50th percentile suggests network latency isn't a key issue, and that it's a limitation of the server or the network. I suggest monitoring CPU and network bandwidth during the test. When I benchmarked Nginx on my AWS t2.micro it barely uses any CPU and network bandwidth seems ok, but at some point it just stops scaling. I could try distributed test clients, but I didn't care enough at the time.
    – Tim
    Sep 28, 2017 at 22:22
  • Gotcha! Even I thought CPU wouldn't budge but it's utilisation was at 100% during the test. I should add that it's just a $5 Linode VPS. It's scalability is way beyond my marketing skills so I don't need to worry about scaling it further as of now, but the geek in me wants to benchmark more. 4am now though, so later.
    – Ashfame
    Sep 28, 2017 at 22:26
  • CPU at 100% is a sign something isn't right. I couldn't get Nginx over 2% CPU when I was benchmarking, but I was using page caching. Perhaps you could edit your question to include your Nginx config. If you have any "if" statements I'd suggest you find a way to remove them, you can often do things in a more efficient way using regular expression matching.
    – Tim
    Sep 29, 2017 at 0:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .