I want to make a system
Articles such as the need to sort the contents of the operation using MySQL
But for a data layer such as a classification table, I want to store it in text so that I can skip the cache and effectively reduce the number of database queries
I am a little hesitant about this idea, please experts to teach!!
Reply content:
I want to make a system
Articles such as the need to sort the contents of the operation using MySQL
But for a data layer such as a classification table, I want to store it in text so that I can skip the cache and effectively reduce the number of database queries
I am a little hesitant about this idea, please experts to teach!!
I don't know what you're saying about caching.
Caching is used to put data into memory to reduce the IO of persistent storage, why skip it?
For this kind of data, my advice is:
- Put it in MySQL, easy to edit and query
- Put a layer of cache, reduce DB IO
1. mysql itself has query cache, which can be considered close to memory performance, and if a small segment of the configuration type of data can be set to constant table to improve read performance.
2. For files, the Linux system also has a memory cache, multiple read performance near the memory speed. Win seemingly the latest system also has to do in-memory file cache.
The respective costs:
1. The cost of MySQL query cache is the re-parsing of TCP connections and SQL
2. Caching of Linux systems is essentially the FD overhead of reading files
Regardless of the caching method, the overhead is data deserialization.
Single case:
Must be the fastest memory cache. If you do not intend to use memory, preferably with MySQL constant table. Although the use of the system cache will be faster, but the file operation involves reading and writing locks, backups, and so on, your own handwriting will be more troublesome--of course, as a practice to try to ensure the integrity of the file data, or if the DB load is high, you can also consider putting files.
Multi-Machine situation:
Basically only MySQL is optional ... Of course you can still store files on one machine, and then write a service for other servers to use.
All in MySQL. Text storage is also to read and write to the disk, the common things can be used memcache cache, direct read memory is certainly faster than the read disk.
You read the disk when you save the text. Read cache is read memory. Definitely read the memory fast.
Still look at the amount of data, if only a few m, that convenient to press which;
Big Point, the back with MySQL storage data, the front to hang a layer of cache, but also to solve most of the application scenario