Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for
PHP start_session() running very slowly
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- PHP start_session() running very slowly
PHP start_session() running very slowly
08-01-2016 9:50 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Sometimes the pages in my CGI webspace load very slowly. I've tracked it down to calls to php's session_start() which, when it's slow, take a little over 30 seconds. It interesting that this time when slow is always just over 30 secs, as if something's timing out.
Can you think of a reason why session_start() would run slowly, or any ideas of things I could try?
Peter
Can you think of a reason why session_start() would run slowly, or any ideas of things I could try?
Peter
Message 1 of 5
(2,203 Views)
4 REPLIES 4
Re: PHP start_session() running very slowly
09-01-2016 11:04 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
As you say taking just over 30 seconds when "slow" could be time-out related. Do you have a feeling for how long this might have been happening? Weeks?
I wonder if "slow" instances mean a change of server host, "not slow" instances the same host. Is it possible to reproduce the problem using a basic page that simply displays the hostname of the server that generated it?
David
I wonder if "slow" instances mean a change of server host, "not slow" instances the same host. Is it possible to reproduce the problem using a basic page that simply displays the hostname of the server that generated it?
David
David
Message 2 of 5
(1,000 Views)
Re: PHP start_session() running very slowly
10-01-2016 2:05 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Interesting thoughts. I've had suspicions that this has been hapenning on and off for a few months now. I've put log writes in my PHP before and after the call, so I'm prety sure that's where the problem is. Sometimes when I refresh the page it takes just over 30 sec, sometimes less than a second (but nothing in between).
I'll look at doing something to display the host name and see whether there's a pettern there.
Peter
I'll look at doing something to display the host name and see whether there's a pettern there.
Peter
Message 3 of 5
(1,000 Views)
Re: PHP start_session() running very slowly
10-01-2016 10:17 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Suspecting this problem has occurred for "a few months" is interesting. To try to be a little more precise, would you say that means 2 or 3 months, 5 or 6 months, or perhaps longer?
I think what you are experiencing is a problem with exclusive file access locks on the session file when multiple server hosts are involved. Since an flock function is built into PHP I assume session_start() uses that for setting its locks.
For a while I've had a similar problem, but with flock in Perl. In my case the lock is used to prevent two or more independent visitors to a page causing a file to be updated at the same time (and overwriting each others updates). In my case I think each visitor is likely to be served from a different host in the cluster.
At the moment Plusnet and Hostopia are playing ticket tennis with the support query. Hostopia failed to find any system change around the time the problem first occurred. Moreover they claim flock works with myself supplying hard evidence (even using their test case) that it doesn't. The problem manifests itself as 30 second delays in my tests for something that should complete in milliseconds. Necessarily Plusnet support are the intermediary between me and Hostopia but I must emphasise that Plusnet support has been exemplary through this saga.
My problem is with the Perl implementation so having a similar one with PHP is very useful. To this end if would be most helpful if you could create a simple test page showing test date and time, page loading times and the server hostnames involved.
David
I think what you are experiencing is a problem with exclusive file access locks on the session file when multiple server hosts are involved. Since an flock function is built into PHP I assume session_start() uses that for setting its locks.
For a while I've had a similar problem, but with flock in Perl. In my case the lock is used to prevent two or more independent visitors to a page causing a file to be updated at the same time (and overwriting each others updates). In my case I think each visitor is likely to be served from a different host in the cluster.
At the moment Plusnet and Hostopia are playing ticket tennis with the support query. Hostopia failed to find any system change around the time the problem first occurred. Moreover they claim flock works with myself supplying hard evidence (even using their test case) that it doesn't. The problem manifests itself as 30 second delays in my tests for something that should complete in milliseconds. Necessarily Plusnet support are the intermediary between me and Hostopia but I must emphasise that Plusnet support has been exemplary through this saga.
My problem is with the Perl implementation so having a similar one with PHP is very useful. To this end if would be most helpful if you could create a simple test page showing test date and time, page loading times and the server hostnames involved.
David
David
Message 4 of 5
(1,000 Views)
Re: PHP start_session() running very slowly
06-05-2016 10:29 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
@Kiwi2, are you still relying on the same scripts and if so, how are they performing now? I've good reason to believe that things should have improved towards the end of March?
Bob Pullen
Plusnet Product Team
If I've been helpful then please give thanks ⤵
Message 5 of 5
(985 Views)
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- PHP start_session() running very slowly