Use session or use database?

0

Summary: Which alternative would "save" the server? I want to be able to store a large array in a session (name, email, cpf, city etc) or always make a query in the database (mysql) when I need an information (considering that every second of hundreds of queries would be performed)?

I never had to worry about this kind of thing, but now I have a client that has a site with more than a thousand simultaneous accesses and the server is very bad (I have already suggested changes, new servers / services and everything was barred ), is always falling. So I'm worried about a system I'm developing. Basically, this system deals with user registration and query of users in the database. As the server is already bad, I do not know which alternative (session or queries to db) would be the "less worse".

On the duplicate: no answer of the question was conclusive and the author also did not speak about anything.

    
asked by anonymous 02.03.2018 / 19:13

3 answers

0

It depends on how much you access and need this data, and "where" it would be interesting to store it.

As there are many accesses, the more the client side you play, the more you release your server, and vice versa.

Thinking about the server, of course if you already have an open session for each user, then better to have it in $ _SESSION, since the bank request requires more processing than a simple session query.

You can also think of cookies, and the client will pass you some necessary parameter in a request.

There are several factors that come into consideration (security, server, client, structure, etc.), but everything depends on your need.

    
02.03.2018 / 19:23
0

I recommend using SESSION for your user's personal data to use the application and only that, the rest would be done by queries to the same DB.

As for the number of concurrent users and accesses, a study is needed for better application performance, and if a user is not satisfied with the presentation of the content generating errors or too much time to see their content, this will generate dissatisfaction.

A technical study should be presented for improvements at all times.

    
02.03.2018 / 19:33
-1

Look, being brief. I believe it should store on servers. If you store in the bank, you may run the risk, depending on some variables, of dead lock occurring in the bank.

Regarding the use of the server, if it is not supporting, unfortunately the solution is to scale.

    
02.03.2018 / 20:41