Read/Write File vs. Query Database
My website has a large number of readers every day. I wanted to track the traffic of each article. For each visitor, I adde开发者_Go百科d a unit on the counter. I'm confused between two solutions:
- Saved to a file on the server. Create the cron jobs to update them on the database.
- Save directly to database.
Should I do now?
I will choose 1 approach, for best result You could save that file on some other hard disc. You must remember that when you observe something, that observation have influence on the result, so to have more reliable result you should minimize this influence.
For working with data you can easily later import them to database.
What about a memorydatabase? Memcached or something. No disk-impact and speedy..
精彩评论