How many session variables per user are considered too large? - PHP

If I have a website on which users register and log out, and each user has 4 session variables used, how will this affect my site?

Tell me if I have 100,000 active members, then it will efficiently transfer 400,000 session variables at the same time. Will this affect my site loading? I understand that php has a memory limit, but does not fully understand it.

thanks

+6
source share
3 answers

4 variables for the user is nothing, but my suggestion will be on a different level: focus on what causes the actual bottlenecks on your website. This problem is probably not relevant right now, and can be easily switched in the future if it slows you down. (And it won't be)

I bet you have much more important things to work with than worrying about another variable, and when you get to so many active users, your whole structure is likely to change, including servers and solutions. Good luck

+6
source

To answer briefly - yes, it will affect the loading of your site if you have 100k users. But because of the sessions he will only , they will become part of the bottleneck.

It is easy to calculate the possible memory consumption, and in accordance with this you must decide how to scale your site. The scaling options are endless (well, of course, of course, there are many ways to scale programs, but there are many more).

If it happens that you attract a lot of users, most likely you can afford professional help when it comes to scaling your site.

If you are interested in knowing what these options are, then it is best to ask a question based on specific things that may bother you when deciding when and where bottlenecks might be.

In addition, you do not deploy sites with so many active users on one server using the default PHP configuration, especially the first session.

+1
source

The answer, of course, is "dependent on."

STRONG OFFER:

1) Set a "baseline performance"

2) Consider resources such as processor, memory, network, and disk.

3) Consider the OS, web server, application and database

4) Carry out stress tests and compare your effectiveness between “normal loads” and “high loads”

5) Identify bottlenecks and apply them properly.

Assuming you are using Linux / Apache / MySql (a general guess on my part - you did not say), here is a great three-part article to help you get started in the right direction:

But believe me: worrying about little things like, for example, you have 5 session variables or 4, instead of trying to collect solid basic statistics, will NOT help you scale up to 100,000 users :)!

0
source

Source: https://habr.com/ru/post/899371/


All Articles