Score:0

Increased TTFB in HTTP load balance

pe flag

We have our own rack in Amsterdam, Leaseweb.

We do HTTP load balance (via Cloudflare) with 3 Windows 2019 IIS servers:

  • Server 1: Bare-metal supermicro server. Runs IIS, MySQL8, and Redis.
  • Server 2: VM on Dell server. Runs IIS.
  • Server 3: VM on Dell server (exact copy of server2). Runs IIS.

The files are locally served in all causes (via replication)

Now the problem is that the TTFB, as measured locally on the server is higher on server 2 and server 3 (VMs).

Running (multiple) tests LOCALLY with chrome:

Server 1:

  • Waiting (TTFB): 269ms
  • Waiting (TTFB): 255ms
  • Waiting (TTFB): 253ms

Server 2:

  • Waiting (TTFB): 379ms
  • Waiting (TTFB): 376ms
  • Waiting (TTFB): 369ms

Server 3:

  • Waiting (TTFB): 374ms
  • Waiting (TTFB): 381ms
  • Waiting (TTFB): 378ms

As you can see, server one has significantly lower TTFB. In terms of CPU, servers 2 and 3 are actually faster:

PHP BENCHMARK SCRIPT

Server1 Total time: : 4.022 sec.

Server2 Total time: : 2.866 sec.

Server3 Total time: : 2.936 sec.

The I/O is about the same for all servers. They all have new SSDs with hardware raid controllers.

I did test moving Redis to one of the VMs so I could figure out if the extra latency comes from Redis, but it does not make a bit of difference.

My assumption is that the extra latency in TTFB comes from MySQL that runs on server 1? Running the MySQL on the same server produces significantly smaller TTFB even though the CPU is slower.

Is there a workaround to this?

Actually, the proper question is, how can I identify what the cause of extra latency is?

ua flag
TTFB for what? A web page? Apache? PHP? MySQL 8 in all cases? Redis?
pe flag
IIS, webpage. We have one instance of MySQL8 running on server1.
ua flag
How many CPU cores? You are suggesting that the existence of MySQL on the machine is slowing down the creation of a web page by IIS on the same server?
pe flag
No. The exact opposite. On the machine where MySQL runs, TTFB is lower.
Wilson Hauck avatar
jp flag
What is the result of SELECT @@VERSION; on Server1 and Server2 and Server3?
pe flag
This is the same for all servers: mysql> SELECT VERSION(); +-----------+ | VERSION() | +-----------+ | 8.0.27 | +-----------+ 1 row in set (0.00 sec)
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.