diff options
author | Alexandre Flament <alex@al-f.net> | 2021-08-14 20:12:11 +0200 |
---|---|---|
committer | Alexandre Flament <alex@al-f.net> | 2021-08-24 14:51:20 +0200 |
commit | 3b0f70ed0f981f76d90a8fab2a2bb73e5b1b97bb (patch) | |
tree | fbdb0734a49fcd32ba97e816a1ceab86d5e5c462 /searx/network/network.py | |
parent | 43fcaa642a63d75096b33d44ce7f7c0de1bce614 (diff) | |
download | searxng-3b0f70ed0f981f76d90a8fab2a2bb73e5b1b97bb.tar.gz searxng-3b0f70ed0f981f76d90a8fab2a2bb73e5b1b97bb.zip |
[mod] /image_proxy: use HTTP/1 instead of HTTP/2
httpx: HTTP/2 is slow when a lot data is downloaded.
https://github.com/dalf/pyhttp-benchmark
also, the usage of HTTP/1 decreases the load average
Diffstat (limited to 'searx/network/network.py')
-rw-r--r-- | searx/network/network.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/searx/network/network.py b/searx/network/network.py index e7dc5b56e..94e91593d 100644 --- a/searx/network/network.py +++ b/searx/network/network.py @@ -289,6 +289,14 @@ def initialize(settings_engines=None, settings_outgoing=None): if isinstance(network, str): NETWORKS[engine_name] = NETWORKS[network] + # the /image_proxy endpoint has a dedicated network. + # same parameters than the default network, but HTTP/2 is disabled. + # It decreases the CPU load average, and the total time is more or less the same + if 'image_proxy' not in NETWORKS: + image_proxy_params = default_params.copy() + image_proxy_params['enable_http2'] = False + NETWORKS['image_proxy'] = new_network(image_proxy_params) + @atexit.register def done(): |