开发者

Could preg_replace be causing a heavy enough load to cause 502s?

开发者 https://www.devze.com 2023-04-03 01:34 出处:网络
I use preg_replace in my Bbcode parse function. I have an array of simple search strings using regex and an array of simple replace strings. (About 15 lengthy strings each.)

I use preg_replace in my Bbcode parse function. I have an array of simple search strings using regex and an array of simple replace strings. (About 15 lengthy strings each.)

Thi开发者_如何学JAVAs function is being used very frequently. Could this be the cause of my recent 502s?

I've made a few changes and this is one of them. I'm trying to locate the problem.

Thanks.


I would recommend profiling your application with xdebug. It's a free extension to php which will show you exactly which functions/portions of code are causing the slow execution.

However, test it on a local server, because xdebug is very heavy and will slow down your application if used on a production server.

You can examine xDebug's output files with Webgrind - http://code.google.com/p/webgrind/

And to answer your question exactly - I don't believe preg_replace will cause your script to become this heavy.

0

精彩评论

暂无评论...
验证码 换一张
取 消