-
Notifications
You must be signed in to change notification settings - Fork 41
Weird issue with plugin at HostGator shared hosting #18
Comments
I wonder if it's because of Wordpress's |
Support was support and seemed to me that guy was far from bits and bytes. So, there's no information that can help us. I asked him for technical guys but well… Still, maybe I have something for you. I went through PHP configuration and I saw it is running in CGI mode. It should mean that every request gets its own PHP process. I think this is why they have page where suggested number of requests per hosting package are listed. As my blog uses caching then requests to posts and other pages are usually fast - 0.2-0.5s and perhaps this is why it is able to survive more load than I have ever expected. Although cache is used it is served by WordPress plugin and it means that ApplicationInsights works also for cached requests (I suppose). There's one option to make the number of requests to pile and this can happen with server-side requests to other sites when network connection is slow or when server on the other end doesn't respond fast enough. I mean, if request to external machine takes usually let's say one second then it's suddenly 8 seconds and requests start piling as they are waiting for response. If this is the case then I can think about few ways how to solve the problem:
Not sure if point 2 is valid and has any meaning but it looks like a good idea to break one dependency to external resource. |
@gpeipman I think this may be the case I don't think sending to Application Insights will take seconds, but sometimes it may be up to a second (with slower networks). One solution may be to send request and do not wait for response. But Another issue suggest to implement some batching and back off logic: microsoft/ApplicationInsights-PHP#50 So perhaps one good solution will be to start background process that uploads data and all requests just dump information to specific file location. Does HostGator allow some writeable file system location and start separate processes? |
Yes, of course, otherwise it would be close to impossible to use WordPress normally. My simple shared hosting package supports also cron jobs, so I think it has everything needed. If it is okay for Application Insights then it's not a problem when cron job runs once or twice per hour. |
@gpeipman I was thinking more like once a minute. Otherwise the delay for data upload will be too high. So maybe php script with the infinite loop and sleep. Not sure if it's a best practice in PHP. Would you be interested to contribute? These SDKs (PHP and wordpress) are community supported, not officially maintained. But I'll be happy to review and help where I can. |
Hosting guys usually doesn't like those endless scripts and some of them may have also guarding systems that kill processes that have been up for too long. To get rid of this there are two options:
If cron job happens frequently it's possible that hosting takes it as a sign of something suspicious. In this means it would be important even there to have small request timeouts. To contribute I have to understand first how the code works. I know PHP language and some internals of WordPress but I haven't written anything serious on PHP more than ten years. But let's try. |
Contributing instructions are straightforward: https://github.com/Microsoft/ApplicationInsights-WordPress/blob/master/CONTRIBUTING.md You can use docker or just host a local version of wordpress. This line constructs the client: Constructor of TelemetryClient accepts channel as an argument: https://github.com/Microsoft/ApplicationInsights-PHP/blob/fd82b5e1c3b2002b63ac85fad69b3aae2c4c3620/ApplicationInsights/Telemetry_Client.php#L26-L30 So you can create a custom copy of channel in this repository that will implement the same methods as this channel: https://github.com/Microsoft/ApplicationInsights-PHP/blob/fd82b5e1c3b2002b63ac85fad69b3aae2c4c3620/ApplicationInsights/Channel/Telemetry_Channel.php#L221-L230 And method |
How this note can help you get started. Let me know if you need more help. And don't hesitate to point on unclear contributing docs or code structure. We want to make contributions easy and straightforward |
@SergeyKanzhelev I am php dev and would like take care of this issue. |
I got something done and it even works. Request parameters needed by trackRequest() method are saved to file and there's cron job that goes through all saved files, sends data to Application Insights and deletes files. As I'm not WordPress expert I don't have much idea how to fit it to this plugin the way that others can also use it. Anyway, if somebody needs urgent solution then feel free to ping me while I try to figure out how to make this functionality as integral part of plugin. |
Hi,
I used this plugin at my blog hosted at HostGator but had to disable it because of few issues.
Suddenly my blog gave frequently error 500 and few times I saw error messages about curl (page rendered still well). I contacted support about server errors and they told me that my site has more processes than allowed for shared hosting. There were not many people visiting blog at this moment and I have had no issues like this even at some high peak moments. Issues disappeared after disabling this plugin.
As I got not much information by hosting support and they were not very interested in helping me. Therefore I have no feedback by their techies about what was going on at server. As far as I understood from mere mortal feedback given by first line support then for some reason my site spawned new processes and at one point it reached the limit.
Is it possible that some libraries used with this plugin start new processes and is there any way to avoid it?
The text was updated successfully, but these errors were encountered: