optimization - How do I tell how much memory / resources is my php script using up? -


hi guys i'm debugging application here , in nutshell - application dying out on online server or maybe server dying out. have checked application 3 different servers , exhibited similar results, application run while of sudden once i'd opening more , more requests i'd network error or site fail load.

i'm suspecting code here need find out how can make less resource intensive infact don't know why doing in first place. runs ok on localhost machine though.

or because i'm hosting on technically shared host? should specialised hosting hosting application? there lot of complex database queries , ajax requests in application here.

as far checking how memory script using can periodically call memory_get_usage(true) @ points in code identify parts of script using memory. memory_get_peak_usage(true) returns max amount of memory used.

you application runs ok while. single script running time, or many different page requests / visitors? there max_execution_time each script (often default 30 seconds). can changed in code on per script basis calling set_time_limit().

there inherent memory_limit set in php.ini. 64m or lower on shared host.

"...once i'd opening more , more requests..." - there limit number of simultaneous (ajax) requests client can make server. browsers set @ 8 or less (this can altered in firefox via about:config). prevent single client swamping server requests. server configured ban clients open many requests!

a shared host restrictive. however, providing host isn't hosting many sites can quite powerful servers, giving access lot of power short time. emphasis on short time - it's in interests of host control scripts consume many resources on shared server other customers affected.

should specialised hosting hosting application?

you'll have more specific. websites these days 'applications'. if doing more serving webpages , running intensive scripts run period of time may need go dedicated hosting. not benefit, benefit of others on shared server!


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -