First of all, thank you. how do you handle configuration files in your project. for example, I have a key & amp; gt; value configuration, about 1200. I use the yii2 framework. every time the framework starts, all configuration files will be loaded, because there are too many. so I am a little worried about the project... first of all, thank you.
How do you handle configuration files in your project.
For example, I now have a key => value configuration, which is about 1200. I use the yii2 framework.
Every time the framework starts, all configuration files will be loaded, because there are too many. so I am a little worried about problems after the project is officially launched. for example, the number of online users is too large. with such a large number of configurations, will the memory consumed each time be relatively large.
What do you do?
Put it in configuration
Cache
Database
???
My project was officially launched, with an estimated peak value of less than 1 K at the same time.
Please share with us some better solutions. Thank you.
Reply content:
First of all, thank you.
How do you handle configuration files in your project.
For example, I now have a key => value configuration, which is about 1200. I use the yii2 framework.
Every time the framework starts, all configuration files will be loaded, because there are too many. so I am a little worried about problems after the project is officially launched. for example, the number of online users is too large. with such a large number of configurations, will the memory consumed each time be relatively large.
What do you do?
Put it in configuration
Cache
Database
???
My project was officially launched, with an estimated peak value of less than 1 K at the same time.
Please share with us some better solutions. Thank you.
There are a lot of configuration items. If the system performance requirements are relatively high, we suggest using the redis cache method, and then you can add a background page to dynamically manage these configuration items. In addition, we recommend that you group configuration items, such as pre-loaded configurations and lazy configuration. You can use configurations that are not required by the current module in other modules for grouping and differentiation. you can load configuration items as needed, in addition, you can also group data by dimensions such as the development environment, test environment, and formal environment. Finally, to reduce errors caused by redis faults, we recommend that you put the default configuration in the file, and make an error message, the so-called downgrade.
Yac you deserve
The configuration file is stored separately, for example:
db.conf.phpftp.conf.phpcache.conf.php
Then write a class library and load the class library as needed, as shown in figureConfig::get('db.user_name');
I think you have considered it too much. loading this configuration file is not a problem with your traffic volume, especially after you enable the php opcache.
You can use the AB test to perform a stress test.
For Laruence Yac, consider
Thank you for your consideration.