-
Recently, when troubleshooting an online problem, I found that the nginx log $upstream_addr field actually returned 2 values, in the form of '192.168.1.1:80, api-servers', where api-servers refers to you The upstream is followed by the group name, and the part has only one value 'api-servers'. Under normal circumstances, this place should be like "192.168.1.1:80", that is, one request falls to one backend service.
-
When nginx starts or rereads its configuration, to speed up processing of some static data sets (such as server names, MIME types, etc., which you may have encountered when configuring nginx), it stores these data in a cache block (cached in a storage device between memory and CPU registers, close to the CPU. Modern CPUs have L1, L2, and L3 encapsulated within the CPU, which is characterized by speed, faster than memory but slower than registers). The size of this cache block is controlled by the parameter server_names_hash_bucket_size. The default size varies depending on the physical CPU, usually being a power of 2. When increasing the size, adjust the value according to the CPU level.