First of all, thank you.
I would like to ask you in your own project is how to deal with the configuration file.
For example, I now have a key=>value configuration, about 1200 or so. I use the YII2 framework.
Every time the framework starts, it loads all the profiles because it's much more. So a little worried about the project will be a problem after the official launch. For example, there are many people online. This is more configuration, each time the memory consumption will be relatively large.
How do you deal with this, please?
Put it in the configuration.
Cache
Database
???
My project is officially on-line, with an estimated online spikes of less than 1k users.
Please share a better solution. Thank you.
Reply content:
First of all, thank you.
I would like to ask you in your own project is how to deal with the configuration file.
For example, I now have a key=>value configuration, about 1200 or so. I use the YII2 framework.
Every time the framework starts, it loads all the profiles because it's much more. So a little worried about the project will be a problem after the official launch. For example, there are many people online. This is more configuration, each time the memory consumption will be relatively large.
How do you deal with this, please?
Put it in the configuration.
Cache
Database
???
My project is officially on-line, with an estimated online spikes of less than 1k users.
Please share a better solution. Thank you.
Configuration items are very much, if the system performance requirements are relatively high, it is recommended to use the Redis cache, and then add a background page to dynamically manage these configuration items, in addition, it is recommended to group configuration items, such as pre-load configuration, lazy load configuration, Other modules to use but the current module does not require the configuration of the group to differentiate, what needs to load what, in addition to the development environment, test environment, formal environment and other dimensions of the grouping, finally, in order to reduce the problem of Redis failure caused by error, it is recommended to put the system default configuration in the file, And make an error reminder, so-called downgrade use.
Yac you deserve to have
Configuration files are stored separately, such as:
db.conf.phpftp.conf.phpcache.conf.php
Then write a class library on demand lazyload load, asConfig::get('db.user_name');
I think you are worried, under your traffic volume, loading this configuration file is not a problem, especially after opening PHP Opcache
You can do the stress test with the AB test.
Laruence's Yac, you can think about it.
Thank you so much. It seems that the specific situation should be specifically treated.