Caching question MySQL or Filesystem

99封情书 提交于 2020-02-04 05:24:06

问题


is there a noticeable speed performance difference when you cache the data which you retrieve from the database to a file on the filesystem (eg.: htdocs/cache/cachefile) rather than grabbing it directy from the MySQL DB?

Thanks a lot!


回答1:


This highly depends on your disk IO, the size of your database, the database configuration, the link to your database, the optimization of the database, etc, etc. So there is no definitive answer to that.

You might want to consider memcached for your caching problem you have. Since you provided no information about the actual issue i'm in doubt you'll get good answers to resolve your problem. Or do you just want to know if disk-io is faster than mysql? ;-)




回答2:


Yes. What you are describing is a common method of speeding up web applications.




回答3:


The noticeable speedup question does also depend on the types of queries and frequency. If it is a once-a-day query, probably not so much. If it is the same query over and over again then probably more so.




回答4:


If you want to use the database just for caching mysql memory tables might be a good alternative. This should give you the benefits of an sql database without having to use the harddisk. If you don't need a sql-database in general memcached is a great solution.



来源:https://stackoverflow.com/questions/1433243/caching-question-mysql-or-filesystem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!