W
W
WAYNEDEV2020-02-19 22:06:01
PHP
WAYNEDEV, 2020-02-19 22:06:01

How to organize mongoose + socket.io if calls to the database can be every second?

Hello!
Applications will be from node + vue + mongoose + socket.io
The problem is that requests to the database can be every second and there should be a quick response to the client, but I don’t know how best to organize
I’m afraid of overloading the database
Tell me something?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Pushkarev, 2019-06-21
@AXP-dev

Your constructor is not declared correctly. Or remove or refactor to __construct

function MYSQL_SESSIONS()
    {
    }

I
Ivan Chernyshev, 2020-02-21
@IvanBlacky

To begin with, determine what the queries will be (by which fields documents will be selected from the database and by which fields the results will be sorted), and what will be the frequency of changes to this data. Index these fields.
Dock by indexes in monge
If the data does not change every second, then you can introduce additional caching using memcached or Redis

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question