Giter Club home page Giter Club logo

Comments (5)

robertu7 avatar robertu7 commented on June 4, 2024

Since the article won't be changed after published, I think long-time (months or years) cache or even directly store translated versions in the database may good choices.

Personally, I more prefer the latter:

  1. The memory of ElasticCache eaten by static contents is a waste;
  2. ElasticCache might be flushed at any time;

AWS S3 is also an option, but it may take more cost on implementation and billing (I/O, Network, Storage, etc.).

from matters-server.

robertu7 avatar robertu7 commented on June 4, 2024

For Caching Strategies, I think Lazy Loading is good for us, which means old & new articles don't need to be prefetched:

  1. Return translated data if exists in DB
  2. Retrieve translated data from Google Translate and store it in DB, then return

from matters-server.

guoliu avatar guoliu commented on June 4, 2024

For Caching Strategies, I think Lazy Loading is good for us, which means old & new articles don't need to be prefetched

Agreed. objectCache directive is already using a simple lazy loading strategy: it tries to get data from cache, and if cache misses, it gets from original source, which is Google translation, and then stored in cache.

The delay in SSR query we saw yesterday were from a high peak in cache misses, which result in hitting translation rate limit. But it looks like the cache has been filled quite fast and most frequent viewed articles are cached now.

Personally, I more prefer the latter:

The memory of ElasticCache eaten by static contents is a waste;
ElasticCache might be flushed at any time;
AWS S3 is also an option, but it may take more cost on implementation and billing (I/O, Network, Storage, etc.).

Yes, the additional implementation cost is a good point. We will always need lazy loading cache strategy, and might want to expand its usage, so that we can guarantee a fast return for frequent viewed content.

If we decide to use a month or years long cache, maybe there is no need of disk storage, since Google translation call will be reduced a lot. However this way we will need to implement better cache purge or update mechanism, and handle rate limit issue (for example by returning null first) in case we need to update cache schemas 🤔

from matters-server.

guoliu avatar guoliu commented on June 4, 2024

Another thought is that, since we need to query language for each article every time, we can store language in database first.

from matters-server.

guoliu avatar guoliu commented on June 4, 2024

Implemented with #1149

from matters-server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.