Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

How to use MemoryStorageClient with redis for Request Queue? #871

Unanswered
abhichek asked this question in Q&A
Discussion options

Currently, as per source code, RequestQueue uses MemoryStorageClient by default. However, MemoryStorageClient uses file-based storage rather than in-memory storage. I am planning to use Redis as a storage backend for higher throughput.

Can anyone help me with an example of how to configure RequestQueue or MemoryStorageClient to use Redis as storage backend?

You must be logged in to vote

Replies: 3 comments · 3 replies

Comment options

Hello! Your best course of action here would be to implement a custom RequestManager that would use Redis as the storage backend. Then, you can pass an instance of the new class to your crawler constructor, e.g., ParselCrawler(request_manager=RedisRequestManager()) and everything should work as expected. Feel free to reach out for more help!

You must be logged in to vote
3 replies
@abhichek
Comment options

Thank you @janbuchar . That sounds like a good solution. Since I'm using PlaywrightCrawler(), I will try implementing your suggestion and reach out if I need further assistance. In the meantime, could you please let me know if it's possible to either connect to a remote browser or keep the browser open?

@janbuchar
Comment options

Glad to help. PlaywrightCrawler doesn't allow using playwright.connect as of now, so connecting to a remote browser will be difficult. Regarding keeping the browser open, what exactly do you have in mind? Would you like the crawler to keep waiting for new requests even if the queue is "empty"?

@janbuchar
Comment options

Connecting to remote browsers is tracked in this feature request for JS crawlee. Once we manage to implement that, a Python version is sure to follow. It may come sooner, too - we'll see 🙂

This comment was marked as spam.

Comment options

Hi, I would like to add that in the future, implementing a custom storage client (e.g., for Redis) should become much easier, as we have a storage client redesign on our roadmap (#783, #92, #307).

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
t-tooling Issues with this label are in the ownership of the tooling team.
4 participants
Converted from issue

This discussion was converted from issue #869 on January 06, 2025 12:21.

Morty Proxy This is a proxified and sanitized view of the page, visit original site.