Questions tagged [caching]
Questions regarding cache algorithms by applications and implementations of information caching by database engines and other information repository and presentation applications.
254
questions
0
votes
0
answers
44
views
Distributed caching system that scales and enables real-time UI updates?
I have a NextJS app for which I want to cache data from our backend APIs to reduce the load when we have high volumes of concurrent users scrolling through (or search) years-worth of historical data.
...
-1
votes
1
answer
135
views
How do I solve caching problems such as cache invalidation and data race in a monolithic app?
When creating a distributed web application, cache invalidation can be a big deal. However, our web application doesn't need distributed load, as we don't expect to serve more than 1k users at a time. ...
1
vote
0
answers
37
views
How to improve an Expo Go app with firebase and local cache in Redux
For learning purposes and fun, I created an Expo Go app with react-native for recipes. It has a firebase database and uses redux to manage state locally on each device. So far so good. A couple of ...
1
vote
1
answer
82
views
Non blocking algorithm for invalidating and reloading cache in concurrent environment using Redis (with Redisson)
I'm trying to come up with a peace of code that would fetch centralised cache shared across multiple threads/app instances. Callers might come in swarms. The data is a large set, reads during ...
-2
votes
2
answers
261
views
How does Java and other managed languages achieve any performance, if everything is allocated at random places of the heap? [closed]
Prelude
Recently, I helped a friend of mine in coding him a problem for his university Algorithms course, where problems are submitted in Java. I sent him code with good O notation complexity, ...
0
votes
2
answers
141
views
API - What are some good strategies to limit hitting database on query-based searches?
I'm building an API that allows people to search for books (just for simplicity). There is an endpoint that takes a query string and returns the top 10 matched results. For example:
/api/v1/book/find?...
1
vote
3
answers
322
views
How to synchronize cache writes in a distributed system?
I am looking for a complete pattern implementing cache-aside when used in a distributed system across multiple nodes read/writing from/to cache.
Specificly how to avoid making multiple requests to db ...
1
vote
2
answers
285
views
Handling simultaneous duplicate expensive read-only HTTP requests
(updated)
We have a read-only REST endpoint that performs a somewhat “expensive“ but transient request. Without client needing to poll, we need a mechanism for the server to avoid unnecessary ...
5
votes
1
answer
4k
views
Best way to store quite large JSON objects?
I'm building an app where I need access to quite large reports about different publicly accessible URLs, JSON objects about 200kb to 500kB in size. Each user would generate hundreds of these reports ...
0
votes
1
answer
127
views
How can I implement a lazy-loading cache for REST objects with custom role-based access?
I'm thinking through adding a lazy-loading cache to my API. Currently, REST objects are filtered out (scoped) based on the user's role, and additional constraints in the system. Users of the same role ...
0
votes
3
answers
131
views
Optimizing writes over the same entity in relational DB
I am developing a micro service that saves votes to a relational database. I have a use case with an entity that represents an aggregation of votes. I receive events from voters saying that they vote ...
0
votes
0
answers
107
views
Cache publishing updates, or clients polling the cache?
Context:
I am working on an application which loads a cache on startup - periodically refreshed. However it turns out that this cache is something which is very general and can be used by other ...
-1
votes
1
answer
79
views
Is it practical to cache multiple instances of variable API data (updates hourly for each instance) for N users?
I'm using flask with SQLAlchemy on a postgresql database for a mobile app I'm building. My application allows a single user to save lets say up to 5 different locations which are saved in the database....
0
votes
1
answer
355
views
Optimal way Implement a Session Cache
I have an App that connects with Salesforce and do different operations. So I'm trying to implement a Session Cache for the Application to avoid repetitive login calls.
So far what I have done is I ...
0
votes
0
answers
137
views
How to generate idempotency token for remote cache
We are using a client library over Memcache.
This library has a lot of logic for Memcache client and is indispensable in current form.
One of the API of the library is put which internally just uses ...
14
votes
5
answers
7k
views
How can I efficiently diff a CSV file against a database?
I have an inventory of products stored in Postgres. I need to be able to take a CSV file and get a list of changes—the things in the CSV file that are different to what is in the database. The CSV ...
0
votes
2
answers
3k
views
Simple Java Spring Boot Cache for multi-container system
I have a requirement to cache some static data as it is being consumed by our system. There is a static API that gives a map of records and we are fetching the corresponding record based on request.
...
0
votes
0
answers
87
views
Effective cache solution to have the newest data in React Native
Goal
We have an app with different articles. I want to cache an article when the user has read it, but make sure that I display the latest data. I came up with this hook:
React.useEffect(() => {
...
1
vote
1
answer
109
views
Contextual Implementation Overhead vs Redundancy
I have an application that has use cases relative to where it is used. A local client and server, where all the server data is in a single location and the client queries that server knowing it is ...
-2
votes
1
answer
82
views
Should cached data be kept separate from primary tables?
I have a table in an SQL database for storing information about some business object that looks something like this (details changed so as not to give away what company I work for):
CREATE TABLE ...
1
vote
1
answer
2k
views
Can cache be shared among services via Redis/Hazelcast?
Can cache be shared among services via Redis/Hazelcast?
I have a few microservices A, B, C etc. The Microservice C is mainly for helping other services. Service C periodically updates cache - so that ...
-1
votes
1
answer
34
views
Options to maintain queue of resources that will be uniquely returned
I need to maintain a queue of resources in a cache such that when multiple clients try to pop elements from the queue concurrently, each element would be uniquely returned to only one of the clients. ...
0
votes
1
answer
357
views
Low Latency for multi-million record database in a web app [closed]
As a forewarning, this is for a school project with other school teammates, so my question is just for the sake of learning best practices. We are creating a recommendation system web app which ...
0
votes
0
answers
138
views
Should I use ETag Cache on all HTTP Responses?
I was wondering if there is any downside to using E-Tag cache for every request and response.
To be more specific, I'm building a data heavy SPA connected to a Laravel API and the client insists that ...
-1
votes
2
answers
287
views
Should I make all my business logic depend on the data that comes from the cache?
One of my web services hits a few hundred thousand visits per day where most of the operations are CRUD and we are thinking to get a cache sitting in front of our SQL database.
I have had implemented ...
3
votes
1
answer
2k
views
Best strategy to flush Redis cache used in a distributed environment
Current setup:
We follow the cache-first strategy right now.
Always fetch from the cache first.
If absent in cache, fetch from DB and update the cache.
Cache TTL is 30 min. After this, the cache-key ...
0
votes
2
answers
529
views
Taking load off of Rest API with Cloudflare Cache?
I have a server running on AWS which serves data, that is not changing too often (think about a CMS system) to multiple clients.
This service is critical for most of the client apps, thus I want to ...
0
votes
1
answer
225
views
Is it possible for the CPU to read or write to the cache, while I/O device is reading main memory?
If an I/O device is reading the main memory (directly) then is it possible for the CPU to access the cache?
I think it's possible for the CPU to access the cache in case of a hit. But in case of a ...
-2
votes
1
answer
300
views
Recommended way of caching weather information
I'm developing an application that will show some weather information based on the user's location. Since the weather forecast is just a very small feature of the app that complements the main ones, I ...
0
votes
1
answer
52
views
What is the added value of using cache control header on top of CDN for a web application?
I'm a developer on a website which has a server which serves HTML and another server which handles API requests. I use a CDN to cache both the HTML and API responses. I feel that it gives me all the ...
-4
votes
1
answer
321
views
Design a login system
I have a task of designing login system with the requirement below:
If the user login over three times, lock account for the first 5 minutes. The next failed 3 times login-in will lock the user ...
1
vote
0
answers
166
views
Near Real-Time Data Aggregation using Complex Queries
We are working on a multi-tenant SaaS product that has a ledger of all tenant customer transactions, which we use to track invoice states on a line-item level. This particular application will result ...
0
votes
4
answers
375
views
Where is network data stored while awaiting to be written to disk?
I think download rates may depend on these 3 factors: the Network Infrastructure (router, VPN, network card, towers), the RAM or cache, the Final Storage (HDD or SDD or whatnot).
So we take this as an ...
0
votes
1
answer
41
views
Fast sliding cache counter
We have an email system that handles incoming and outgoing emails, the risk is that we get so called feedback loops, a bounce email is answered with another bounce etc. We have safeguards in place to ...
0
votes
2
answers
694
views
What are the differences between memory coherence and cache coherence?
https://en.wikipedia.org/wiki/Memory_coherence says:
Memory coherence is an issue that affects the design of computer
systems in which two or more processors or cores share a common area
of memory.[1]...
-1
votes
1
answer
734
views
Can I call a WCF endpoint from ASP.Net Web API?
I have a web api with controller methods that use rest http(post/get calls).
Clients consume this API with normal httpclient calls and I pass an http response back.
My use case is I have a legacy ...
4
votes
1
answer
692
views
ASP.NET MVC Caching of ViewModels
My question is regarding caching and ViewModels in ASP.NET (Core) MVC.
I have a service which injects a Repository<T> which is used to fetch domain models from the database. The service layer ...
1
vote
3
answers
4k
views
Redis write-through cache vs write-behind cache (message queue?)
I have a simple use case:
Newsfeeds aggregated based on posts that are linked to geopoints
Users can comment on feed posts
Users can like feed posts and comments
I'm certain that Redis as a cache ...
3
votes
1
answer
193
views
Design that hides cache as an implementation detail
I have a type which is fairly heavy (maintains an off-heap object), and which can be uniquely derived from a String. It requires cleanup, so of course the type has a close() method, but it is used in ...
0
votes
0
answers
91
views
Handle big data sets in a web application in combination with real-time communication between web-clients
We have the following use case to be developing:
A web application that shows a data table / data grid with up to 100000 rows and 30-50 columns. Each column is filterable and sortable. The web ...
2
votes
2
answers
249
views
Where to place an in-memory cache to handle repetitive bursts of database queries from several downstream sources, all within a few milliseconds span
I'm working on a Java service that runs on Google Cloud Platform and utilizes a MySQL database via Cloud SQL. The database stores simple relationships between users, accounts they belong to, and ...
-1
votes
1
answer
114
views
Strategy to make sure relevant cache records are expired on data update
In our database, we have around 150 different tables. However, there are a handful of them that are key, as in they get referenced pretty much everywhere. We also have quite a few reports that we pull ...
1
vote
2
answers
418
views
How to cache duplicate fetch and save calls that are fired within the same second
I have a service which provides an endpoint that fetches from another service, saves, and returns an record.
Here are the details:
The caller calls the endpoint using an identifier (say a customer's ...
7
votes
3
answers
1k
views
Best way to reduce database writes?
I couldn't find a similar enough thread, so i'm making a new one. My question is about reducing database writes. Context is that I have an application which increments a number in a database every ...
-2
votes
2
answers
319
views
Caching expensive sql queries on first page load
I have a web application with an express/node backend using typeorm and PostgreSQL. The home page in my app is a query with lots of inner joins that shows the user a complex report. This query takes ...
-1
votes
1
answer
116
views
Design review for a Cache aside system
I am maintaining a system where a list of string ids are stored against a container (using the term here as a generic entity) object. The database used is MySQL and the table structure looks like this....
1
vote
2
answers
545
views
How do I decide an initial in-memory cache size given my DB size and expected load throughput?
(Purely for learning purposes)
Say the DB contains 1 billion rows with 200 bytes per row = 200 GB of data.
The traffic at peak is 1000 requests/s, with each request asking for one DB row.
What cache ...
0
votes
1
answer
662
views
Caching or in-memory table in Azure for performance
I am building an Angular web application that retrieves part of its data from a Azure SQL Database table via APIs developed in Azure Functions (with Azure API Management at the API Gateway). The data ...
1
vote
1
answer
152
views
Writing a data-oriented ECS update loop that handles multiple components
So I have an engine in progress that's structured like this:
entities are simple ids (unsigned short)
components are stored in pools which are static members
systems are stored by the manager, and ...
0
votes
1
answer
284
views
Caching strategy for a fast front-end search
I'd like to implement a fast, smooth search. Searched items are not that many: ~100 max. Each item holds the amount of data a facebook event would hold. They will all show up on initial load (maybe an ...