scrapy-redis turns one Redis queue into a fleet of Scrapy spiders
Redis-based components for Scrapy.
At a glance
- What is it?
- The library supplies a Redis backed scheduler, duplication filter, item pipeline and base spiders so several Scrapy processes share one request queue and one items queue. Its connection handling is the more interesting half, from pooled connections per crawler to the RESP2 escape hatch.
- Who is it for?
- Take scrapy-redis when the crawl is wide enough that separate spider processes would otherwise repeat the same frontier work, and read the connection settings before you scale out, since a capped pool raises ConnectionError rather than waiting and the backoff settings can add up to thirty seconds of pickup delay.
- Can I use it commercially?
- Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 4 days ago.
- What is it written in?
- Mainly Python, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 24, 2026, and from our analysis. They are not legal advice.
Star history
- rmax/scrapy-redis5,648 ★ · +4
| Repository | 2026-09-23 | 2026-11-24 |
|---|---|---|
| rmax/scrapy-redis | 5.6k | 5.6k |
4 Stars in the last 62 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
Several spiders share one request queue and one items queue
scrapy-redis is a set of plug-and-play components rather than a crawler of its own: a scheduler, a duplication filter, an item pipeline and a set of base spiders. The scheduler is the part that scales, because the outstanding requests live in Redis, which lets several spider processes read from the same queue instead of each one walking its own frontier. That arrangement is aimed at broad crawls across many domains, where separate processes would otherwise request the same pages. Post-processing is distributed the same way. Scraped items are pushed into a Redis queue of their own, so you can start as many consumer processes as the machine will carry, all reading from the same items queue. The duplication filter sits on the request side and keeps workers from picking up the same request twice, which matters precisely because the queue is shared. Nothing about the setup requires the workers to be on the same host, though the connection defaults assume one Redis endpoint reachable by all of them.
The pip package leaves out the feature this fork added
Installation has a fork in it, pun intended. From pip it is a single command, and the dependency floor reads as Python 3.7 and newer, Redis 5.0 or newer, Scrapy 2.0 or newer, and redis-py 4.2 or newer. From source the documentation points at a different repository than this one, so the clone lands somewhere that is not this fork:
git clone https://github.com/darkrho/scrapy-redis.git
cd scrapy-redis
python setup.py installThe pip route also costs you the reason this fork exists. The JSON payload support is called out as unavailable when the package was installed through pip, and the stated remedy is to remove that copy first:
pip uninstall scrapy-redisSo the headline feature and the easy install are mutually exclusive, and anyone who wants it has to build from the repository. Version numbers are not hard coded: setup.py reads a plain VERSION file, and the install requirements are parsed out of requirements.txt during the build.
pip install scrapy-redisIdle queue polling backs off only after you switch it on
An empty queue is the quiet failure mode of a shared scheduler. Workers keep polling a list that has nothing in it, and every empty poll is still a round trip to Redis. scrapy-redis can back off, but the switch is off by default, so nothing changes until you set REDIS_IDLE_BACKOFF_ENABLED, whose default is False. The schedule is four numbers. REDIS_IDLE_BACKOFF_MIN defaults to 1.0 second as the initial delay, REDIS_IDLE_BACKOFF_MAX caps it at 30.0 seconds, and REDIS_IDLE_BACKOFF_FACTOR, default 2.0, multiplies the delay after each empty poll. While the feature is active the spider never blocks the reactor and skips all Redis calls until the next poll deadline, and the close deadline is still checked on every idle callback so shutdown is not held up by the backoff. The price is pickup latency: work that arrives during a long sleep waits until the next deadline, up to the cap. That trade pays off when many workers share one queue and most polls are empty.
A shared pool raises ConnectionError instead of waiting
Components of one crawler now share a single Redis connection pool, but only under two conditions: the default client class and plain connection parameters. Pools are scoped per Settings object, so the boundary is the crawler rather than the component. Two routes put you back on the old per-component behavior: a custom client class, or one of the client-only parameters, which are ssl, unix_socket_path and single_connection_client. REDIS_MAX_CONNECTIONS caps the shared pool and applies no override by default, leaving the redis-py pool default in place, which on redis-py 4.x and 5.x is effectively unlimited. That default matters when you do set a cap, because an exhausted pool raises ConnectionError instead of blocking. Waiting behavior is opt-in and explicit: pass a BlockingConnectionPool through REDIS_PARAMS.connection_pool. A pool scoped to one crawler also means the sharing does not extend across crawler processes, so the connection count you set applies per process rather than to the fleet as a whole.
RESP2 became an opt-in again after redis-py 8
redis-py 8 changed its default connection protocol to RESP3, and a protocol choice only affects connection setup, so it does not remove timeout risk on warm calls over an established connection. scrapy-redis exposes REDIS_PROTOCOL with a default of None, which leaves whatever the installed redis-py does untouched. On redis-py 5 and newer you can ask for RESP2 in the discoverable form:
REDIS_PROTOCOL = 2The older spelling still works:
REDIS_PARAMS = {"protocol": 2}Both forms require redis-py 5 or newer, and REDIS_PROTOCOL takes precedence when you set both. There is a second advanced knob that trades metadata for setup work:
REDIS_PARAMS = {"driver_info": None}Two retired paths are worth knowing about. The historical retry_on_timeout=True default is deprecated and has no effect on redis-py 6 and newer, where the retry object and its defaults decide, so measure the result before lowering retries, especially under connection churn or saturation. And with Redis 8.0.2, CLIENT MAINT_NOTIFICATIONS was rejected during RESP3 connection setup, an observation scoped to that server version. MONITOR and commandstats do not show the rejection, so the client logs and the Redis total_error_replies counter are the diagnostic route. The behavior is summarized per redis-py release: 4.2 through 4.x has neither the protocol nor the driver_info knob, 5.x has both with RESP2 the default, and 6.x through 7.x keep RESP2 as the default.
A JSON record in Redis turns into a FormRequest
The addition in this fork is a JSON document in Redis where the upstream project expects a plain URL string. The record carries a url, a meta field that is itself nested JSON holding sub-data, and further optional parameters. The worked example in the documentation looks like this, typo and all:
{ "url": "https://exaple.com", "meta": {"job-id":"123xsd", "start-date":"dd/mm/yy"}, "url_cookie_key":"fertxsas" }When the spider picks the item up, that data is extracted and a further FormRequest is sent with the url, the meta and additional formdata, and the values are reachable in the spider through request.url, request.meta and request.cookies. The scope is deliberately narrow: this covers distributing the workload across workers, and richer requirements such as URL expiration or advanced URL priority go to the Frontera project instead. So the fork answers one question well, how do many workers share a queue, and points elsewhere for scheduling policy.
The container harness runs tox, not a deployment
The repository ships a test harness rather than a deployment recipe. The Dockerfile starts from python:3.11-slim, installs requirements.txt together with requirements-tests.txt, copies the tree into /app, and ends by invoking tox. docker-compose.yaml adds a redis service on the redis:6.2-alpine image with port 6379 mapped to the host, and a python service whose command is:
tox -e security,flake8,pytestThat service sets REDIS_HOST to the redis service name, REDIS_PORT to 6379, and passes both through TOX_TESTENV_PASSENV, with the working tree mounted at /app and depends_on redis. The supported way to exercise the library is therefore a tox run against a throwaway Redis, which is also why the tree carries pytest.ini, tox.ini, setup.cfg, pylintrc, .flake8, .bandit.yml and .pre-commit-config.yaml. On the packaging side, setup.py walks src for packages, reads the version from VERSION, joins README.rst and HISTORY.rst into the long description, and marks the package MIT with a Beta development status and Python 3.7 through 3.10 classifiers. One gap is easy to miss: the requirements file asks for scrapy>=2.6.0, redis>=4.2 and six>=1.15, while the stated Scrapy floor is 2.0. Releases stopped at v0.9.1 in July 2024 even though commits have continued since.
Editorial conclusion
Take scrapy-redis when the crawl is wide enough that separate spider processes would otherwise repeat the same frontier work, and read the connection settings before you scale out, since a capped pool raises ConnectionError rather than waiting and the backoff settings can add up to thirty seconds of pickup delay. Verify two things first: that your Redis server is 5.0 or newer, and that you installed from the repository rather than from pip if the JSON payload feature matters to you.
Frequently asked questions
What is scrapy used for?
Scrapy is the crawling framework this library plugs into. scrapy-redis supplies the Redis backed pieces: a scheduler, a duplication filter, an item pipeline and base spiders, so several spider instances can share one request queue.
What is Redis in Python?
On the Python side Redis is reached through redis-py, which scrapy-redis requires at version 4.2 or newer. It also requires a Redis server of 5.0 or newer, and settings such as REDIS_PARAMS carry connection parameters through to that client.
How do I install Redis for Python?
Install the library with pip install scrapy-redis, which pulls scrapy, redis and six from requirements.txt. If you want the JSON payload feature, the documentation asks you to uninstall the pip copy first and install from the repository instead.
Is there a Scrapy module in Python?
Yes. scrapy-redis is a Python package of plug-and-play Scrapy components: scheduler, duplication filter, item pipeline and base spiders. It requires Python 3.7 or newer and Scrapy 2.0 or newer.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/rmax-scrapy-redis)Star history chart for your README
[](https://hysenlabs.com/projects/rmax-scrapy-redis)Was this useful?