Which is Better? Cache on a Disk File or Cache in a Temporary Table in MySQL
the question is very self-explained, in matter of performance and all, which way is better to store little amounts开发者_StackOverflow of data? MySQL or Small File in a Cache folder?
Thanks in Advance
Database because it will resolve any concurrency problem, which the file doesn't provide you with.
It's impossible to answer such vague (and possible out-of-nowhere) question.
The answer depends on circumstances (if any) which made you to put up such a problem.
For example, Conditional Get HTTP caching will do the job without wasting any space on the server in any form (and good site have to implement it anyway).
If you're taking database as possible solution, why not to use it in proper way? By proper indexing queries and using built in query cache?
If indexes themselves being a bottleneck due to frequent writes, no cache will solve the problem, slow database will make whole system slow. You have to rebuild your database structure in this case.
If it's going to be insufficient key-cache for database server, it's matter of proper tuning or hardware upgrading.
Or zillions other certain recipes to solve certain problems.
Honestly, all that "which is faster" crap has not a slightest relation to performance problems.
The only question can be accepted is "I have certain problem with [something]. Here are benchmarks and investigation results. What's the best solution?"
Otherwise no answer will do help. Especially one from usual Stackoverflow user who just heard of some technology but never used it in real. And always tends to cure a symptom, not disease.
Sorry- but your question is still quite vague in terms of what you mean by "performance".
Temporary tables can only be looked at once, but if you cache the information, you can look at it frequently.
Will you be expanding this function/site in the future? Then I suggest MySQL. It will definitely be worth getting it set up.
Also, pure disk caching can lead to issues if you don't delete the file cache and it fills up your alloted space.
Do you know memcache? Is a nice tool and very simple to use!
精彩评论