简体   繁体   English

什么是更快的php:syslog,文件追加或error_log

[英]What is faster in php: syslog, file append or error_log

Are there any experiences on what is faster in php (ie less overhead, less time): 是否有关于什么是更快的PHP经验(即更少的开销,更少的时间):

  • syslog() syslog()
  • error_log() error_log()
  • explicit file open(), append, close() 显式文件open(),append,close()

Thanks. 谢谢。

syslog will show differences in it's performance, depending on the configuration of the syslog daemon. syslog将显示其性能差异,具体取决于syslog守护程序的配置。 For example, messages might get duplicated into several log files or even sent over the net. 例如,消息可能会复制到多个日志文件中,甚至可能通过网络发送。 Therefore it is not really comparable with the others. 因此,它不能与其他人真正地比较。

Using PHP's error_log() or implementing file based logging on your own shouldn't show differences in it's performance (having that you implemented it efficiently). 使用PHP的error_log()或自己实现基于文件的日志记录,不应表现出性能上的差异(必须有效实现)。 However, I expect error_log() a bit faster since it is simple and written in C, but a custom file based implementation might be more flexible, configurable and produce better/fancier messages. 但是,我希望error_log()更快一些,因为它很简单,用C语言编写,但是基于自定义文件的实现可能更灵活,可配置并且产生更好/更漂亮的消息。

At the end you would need to benchmark and compare those solutions having a real world use case. 最后,您需要对具有实际用例的解决方案进行基准测试和比较。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM