UserAgent parsing is at the moment use HashMap to cache processed user agent string. The problem of this approach is the HashMap could be very big in a real web site: according to https://developers.whatismybrowser.com/useragents/explore/ there could be over 24M user agent strings, this could easily eat up heap of your VM.
This CR is to use a LFU cache to replace hash map, thus the number of cached user agent could be caped, e.g. 1000.
UserAgent
parsing is at the moment useHashMap
to cache processed user agent string. The problem of this approach is theHashMap
could be very big in a real web site: according to https://developers.whatismybrowser.com/useragents/explore/ there could be over 24M user agent strings, this could easily eat up heap of your VM.This CR is to use a LFU cache to replace hash map, thus the number of cached user agent could be caped, e.g. 1000.