Log to file via PHP or log to MySQL database - which is quicker?

前端 未结 15 1258
故里飘歌
故里飘歌 2021-02-03 11:07

I have a database driven website serving about 50,000 pages.

I want to track each webpage/record hit. I will do this by creating logs, and then batch processing the logs

15条回答
  •  野的像风
    2021-02-03 11:13

    I read an article in the C++ Users Journal, years ago, about loggin performance. Whether you use DB or files, the best thing to do is write unformatted data that can be "inflated" into meaningful data when (and more likely if) you need to view the logs. The vast majority of the cost of logging is informatting the strings that are written to the destination, and most of the time that cost is wasted - the logs are never read.

    I can dig out the article reference if it's useful to you.

提交回复
热议问题