Skip to main content
2 of 3
added 46 characters in body
FMJaguar
  • 3.1k
  • 20
  • 15

Keep in mind that node is non blocking when waiting for io, not if you are processing items within your code. If you are using node to loop through or manipulate large datasets, consider offloading that work to the database or other processes.

It also sounds like you are trying to combine database logic (primary keys, rows) with application logic (user views, models) into a single caching function. Consider a dual approach of optimizing at the database layer, and the application layer:

At the database level, Look into your database usage, use EXPLAIN, examine your use of indexes, remove N+1 and other repeated database calls.

At the application level, think of your pages (especially on the initial load) as entire views instead of tables and rows. then cache all of the data needed for the most common views, if the same data is presented to every user, consider caching the entire rendered output. If using ajax calls, consider storing the initial set of cached data as json embedded within the html response. Also look at where your cache is stored, redis and memcached are popular datastores for live site data.

Ref:

FMJaguar
  • 3.1k
  • 20
  • 15