verze-app / solana-php-sdk

Simple PHP SDK for Solana JSON RPC endpoints
MIT License
88 stars 45 forks source link

How to deal with rate limits of JSON RPC? #23

Closed faridmovsumov closed 2 years ago

faridmovsumov commented 2 years ago

Hello,

I found documentation regarding limitations but couldn't find any information regarding proper rate limit controls.

image

https://docs.solana.com/cluster/rpc-endpoints#mainnet-beta

Normally I would expect some header to tell me regarding my quota information to be able to sleep my code for some time but I was able to only get HTTP 429 after I got an error and then retry failed requests which is not the most efficient approach. I am wondering if you figured out already some solution for this problem.

faridmovsumov commented 2 years ago

I think the answer is to use private RPC services recommended on the Solana website. https://solana.com/rpc

image

neverything commented 2 years ago

Hey @faridmovsumov which RPC service did you end up using? I'm currently handling the rate limits with a cache key that is set and releases the jobs back to the queue after the time is up.

faridmovsumov commented 2 years ago

I tried runnode and wanted to try also quicknode before making final decision. Quicknode seems to have strong nft related features which attracted me. Still researching...

neverything commented 2 years ago

Hehe same @faridmovsumov, ran into more rate limits and thinking about giving QuickNode a try.

faridmovsumov commented 2 years ago

Seems like for production-ready applications some solid RPC server is a must.