allegro / bigcache

Efficient cache for gigabytes of data written in Go.
http://allegro.tech/2016/03/writing-fast-cache-service-in-go.html
Apache License 2.0
7.51k stars 595 forks source link

GRPC server support #378

Open ODudek opened 1 year ago

ODudek commented 1 year ago

Hello

Frequent querying and data retrieval from an HTTP server can lead to substantial costs due to the number of requests and the amount of data transmitted over the network. Is it possible to add support for a gRPC server? Does it even make sense? Let me know what you think. I'd be happy to prepare such a pull request if you see any benefit in it.

janisz commented 1 year ago

I think it's a good idea but in a separated repo. I like the minimalist go.mod of bigcache

mpldr commented 12 months ago

I think bigcache is more suited to be embedded into a service, than being its own, to be quite honest.

ODudek commented 12 months ago

@mpldr Why do you think so? I believe something like this would be useful even if we wanted to run Bigcache as a cluster

mpldr commented 12 months ago

On Mon Oct 23, 2023 at 4:18 PM CEST, Olek Dudek wrote:

@mpldr Why do you think so? I believe something like this would be useful even if we wanted to run Bigcache as a cluster

It follows a pattern of microservification of things that shouldn't be microservices. Of course, depending on how your services look, it may be a valid thing to do; but I doubt this is the case for the vast majority of cases. Overall, it's always a team's choice, but most often a cache-service is not a great choice for a microservice.

Main Reason being the triple-ping-latency (read-lock, read, read-unlock) (otherwise, brace for data races) is likely higher than most processing you are doing to the data. And if it is, it's likely a better solution to use a local cache. For reference: See https://www.primevideotech.com/video-streaming/scaling-up-the-prime-video-audio-video-monitoring-service-and-reducing-costs-by-90 (I mean… there are many things wrong with this, but the network traffic is one of them)

-- Moritz Poldrack https://moritz.sh

This is not an offer to sell securities.