Questions tagged [caching]
Questions regarding cache algorithms by applications and implementations of information caching by database engines and other information repository and presentation applications.
267 questions
1
vote
1
answer
131
views
Should pagination metadata like totalCount be included in the ETag for cached paginated API responses?
I am currently rethinking my API response schema and caching strategy while implementing ETag-based caching for a paginated REST API (for example, listing places).
Each paginated response looks like ...
1
vote
4
answers
272
views
A passive LRU cache with locks
Context
I'm working on a client-server-agent application, where server distributes tasks supplied by clients over agents. Server is passive, all communications are initiated by clients and agents.
...
2
votes
0
answers
161
views
Invalidate session for user in authentication
when user login in my web application (Article Website) I'm using Redis to cache the refresh token. So when user login I will generate refresh token and send it to him. While caching in my Redis the ...
0
votes
1
answer
132
views
Best Practice for Managing Payment Subscription Tier Status
I'm trying to understand the best way to approach how to manage and update a user’s payment subscription status in a web application. Let’s say you have a subscriptions table in a database that is ...
0
votes
1
answer
114
views
Designing a Scalable Caching Layer for User and Tenant Metadata in a Messaging System
I'm developing a microservice-based application that processes a high volume of messages. Each message must be handled according to the user’s personal settings and some tenant-specific (customer) ...
6
votes
2
answers
443
views
How can I keep data defragmented and sorted if it's large and often changes randomly?
This problem is very relevant to games and real-time simulations but it may have broader applications. It seems inherently difficult to solve.
The problem:
Imagine that you have a large buffer of data,...
4
votes
1
answer
331
views
Are contiguous objects contiguous in virtual memory or physical?
More or less what the title says.
Suppose we have a sequential container like vector in c++ that will store data contiguously.
When we say that the data is stored contiguously do we mean that it's ...
3
votes
3
answers
636
views
How can single thread execution speed further increase since frequency stagnates?
What are things that newer CPU can do to speed up single thread execution?
multiple registers? (can compilers always benefit from it?)
SIMD? (do compilers use SIMD without code annotation?)
does a ...
3
votes
2
answers
434
views
Populating Cache in microservices
These days I was asked by our technological leader to populate a cache.
The exact nature of the request impacts a back-end (BE) system that operates on a database through a client library.
The BE is a ...
-2
votes
1
answer
375
views
What is the best way to cache paginated data when any page can be moved to and page size is changeable?
I have a React Redux web app that fetches data from an Express/Node backend and MySQL database. I have a table of records that I fetch and store in redux as an array of objects, which I display as a ...
-2
votes
3
answers
322
views
How do I build my application with high throughput in mind? (Need guidance)
I am building a Spring boot REST API app that is part of a microservice architecture project. What I am planning:
My app listens for events from two other services and after some business logic, ...
1
vote
1
answer
77
views
Effectively invalidating multiple entries from one composed key
Context
I m building a dashboard application gathering data from a Rest API
This Rest API can be requested by client applications others than the dashboard to get data
That data is then aggregated ...
0
votes
2
answers
249
views
Can caching increase p90 response time
I'm learning about caching and I realized a positional problem I need clarification on.
Suppose the database p90 response time is too high and we need to decrease it. We are considering adding a cache....
0
votes
0
answers
83
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
216
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
127
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
162
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
303
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
333
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?...
2
votes
3
answers
1k
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
695
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 ...
7
votes
1
answer
10k
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
314
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
155
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
166
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
192
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
598
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
188
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
8k
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
5k
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
114
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
140
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
143
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
4k
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
44
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
450
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
202
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
431
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
724
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
272
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
395
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
112
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
375
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
220
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
785
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
52
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 ...
1
vote
2
answers
1k
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
1k
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
879
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 ...