aws-cloudfront-extensions icon indicating copy to clipboard operation
aws-cloudfront-extensions copied to clipboard

Request doesn't hit same normalized query string cache

Open benkajaja opened this issue 4 years ago • 0 comments

I deploy a normalize-query-string on edge in order to improve cache hit ratio as mentioned in this document. However, it seems like that different query strings (e.g., key2=val2&key1=val1, KEY2=VAL2&KEY1=VAL1) which have been normalized in same order and lowercase (i.e., key1=val1&key2=val2) would not hit the cache.

I know there are four or more edge nodes, and request would pass to one of them as shown in Fig.1.

Fig.1 differentCDN

In this situation, I could not test hit ratio properly. Thus, I modify /etc/hosts on my laptop in order to lock specific edge node. The result is shown in Fig.2. Note that, these requests are finished in 3 seconds (within maxttl=10s)

Fig.2 lockCDN

Logs of hellocdk lambda cloudwatch

Reproduction Steps

Deploy a cloudfront(with normalize-query-string ext) + apigateway + lambda https://github.com/benkajaja/cdk-cloudfront-plus/tree/chore/Add-demo-of-normalize-query-string/src/demo/normalize-query-string

Modify cloudfront domain name(cfdomain) in demo.sh, and then execute it.

What did you expect to happen?

Within same edge node, Task1: Miss Task2: Hit Task3: Hit Task4: Hit

What actually happened?

Miss cache with same normalized query strings

Environment

  • CDK CLI Version : 1.89.0
  • Framework Version:
  • Language (Version):

Other

benkajaja avatar Apr 13 '21 05:04 benkajaja