searxng/docs/admin
czaky 122a9568de [network]: Add redundant parallel proxy requests.
Anecdotally, using SearX over unreliable proxies,
like tor, seems to be quite error prone.
SearX puts quite an effort to measure the
performance and reliability of engines, most
likely owning to those aspects being of
significant concern.

The patch here proposes to mitigate related
problems, by issuing concurrent redundant requests
through the specified proxies at once, returning
the first response that is not an error.
The functionality is enabled using the:
`proxy_request_redundancy` parameter within the
outgoing network settings or the engine settings.

Example:

```yaml

outgoing:
    request_timeout: 8.0
    proxies:
        "all://":
            - socks5h://tor:9050
            - socks5h://tor1:9050
            - socks5h://tor2:9050
            - socks5h://tor3:9050
    proxy_request_redundancy: 4
```

In this example, each network request will be
send 4 times, once through every proxy. The
first (non-error) response wins.

In my testing environment using several tor proxy
end-points, this approach almost entirely
removes engine errors related to timeouts
and denied requests. The latency of the
network system is also improved.

The implementation, uses a
`AsyncParallelTransport(httpx.AsyncBaseTransport)`
wrapper to wrap multiple sub-trasports,
and `asyncio.wait` to wait on the first completed
request.

The existing implementation of the network
proxy cycling has also been moved into the
`AsyncParallelTransport` class, which should
improve network client memoization and
performance.

TESTED:
- unit tests for the new functions and classes.
- tested on desktop PC with 10+ upstream proxies
    and comparable request redundancy.
2024-05-17 02:09:29 +00:00
..
answer-captcha [doc] answer CAPTCHA from server's IP 2023-05-22 10:46:10 +02:00
settings [network]: Add redundant parallel proxy requests. 2024-05-17 02:09:29 +00:00
answer-captcha.rst [doc] answer CAPTCHA from server's IP 2023-05-22 10:46:10 +02:00
api.rst [mod] settings.yml: remove plugin settings for plugins that don't exist anymore 2023-09-29 11:26:49 +02:00
arch_public.dot [doc] update documentation of the installation procedures 2022-07-30 13:39:35 +02:00
architecture.rst [docs] corrections from @tiekoetter's review 2022-07-30 13:39:35 +02:00
buildhosts.rst [fix] typos in documentation & messages 2023-08-13 08:50:29 +02:00
index.rst [mod] isolation of botdetection from the limiter 2023-11-01 06:44:56 +01:00
installation-apache.rst [fix] spelling 2023-09-18 16:20:27 +02:00
installation-docker.rst Docker: add UWSGI_WORKERS and UWSGI_THREAD environment variables (#2992) 2023-11-12 16:46:34 +00:00
installation-nginx.rst [doc] rearranges Settings & Engines docs for better readability 2023-07-01 22:45:19 +02:00
installation-scripts.rst [fix] typos/grammar in docs 2023-04-21 06:51:44 +02:00
installation-searxng.rst [fix] typos in documentation & messages 2023-08-13 08:50:29 +02:00
installation-uwsgi.rst [doc] rearranges Settings & Engines docs for better readability 2023-07-01 22:45:19 +02:00
installation.rst [fix] typos/grammar in docs 2023-04-21 06:51:44 +02:00
plugins.rst [mod] documentation: change the jinja context doesn't depend on searx.webapp 2020-12-27 10:00:35 +01:00
searx.limiter.rst [mod] isolation of botdetection from the limiter 2023-11-01 06:44:56 +01:00
update-searxng.rst [fix] typos in documentation & messages 2023-08-13 08:50:29 +02:00