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

前端 未结 15 1259
故里飘歌
故里飘歌 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:11

    All depends on your infrastructure and limitations. If the disk is slow, writing will be slow. If the SQL server is lagged by the requests, the insert will be slow. Flat file is probably the best way to go, but I would write your code or use existing code (PEAR::Log) so you can change the provider and storage method at will.

提交回复
热议问题