Page MenuHomePhabricator

Use set_time_limit() to extend execution time on write requests
Closed, ResolvedPublic

Description

The HHVM timeout for MW appservers is very long (180 seconds). This is to reduce the chance of unnecessary termination of write requests. For unavoidable performance reasons, many write requests do work in multiple DB transactions, so termination of a write request can produce database inconsistency. And some administrative requests are essential, expensive, and have a very low request rate, such as RevisionDeleteUser. In both cases, server-side timeout can lead to a need for ops intervention.

I propose increasing the timeout of write requests at runtime, using set_time_limit(), so that the default HHVM timeout is not constrained by these use cases. Then the default HHVM timeout can be reduced to say 60 seconds, as suggested in T97204.

MW core could provide a static method or global function to call which notifies it of the beginning of a potentially long-running write request. Then the relevant special pages and extensions could call that function. The function would respond by calling set_time_limit() with a limit specified in the MW configuration. There should be a special configuration value which instructs MW to not call set_time_limit() at all, e.g. false.

Event Timeline

tstarling raised the priority of this task from to Needs Triage.
tstarling updated the task description. (Show Details)
tstarling added a project: Performance-Team.
tstarling added subscribers: tstarling, GWicke, ori, aaron.
Krinkle triaged this task as Medium priority.Jul 19 2015, 7:03 PM
Krinkle set Security to None.

Change 230265 had a related patch set uploaded (by Aaron Schulz):
Added wfTransactionalTimeLimit() method and applied it

https://gerrit.wikimedia.org/r/230265

Change 230265 merged by jenkins-bot:
Added wfTransactionalTimeLimit() method and applied it

https://gerrit.wikimedia.org/r/230265

Change 231191 had a related patch set uploaded (by Aaron Schulz):
Try to make POSTs as transactional as possible

https://gerrit.wikimedia.org/r/231191

Change 231191 merged by jenkins-bot:
Try to make POSTs as transactional as possible

https://gerrit.wikimedia.org/r/231191

@aaron: Was the general time limit already lowered, as proposed in the task description?

I assumed that was part of T97204. This is just the non-config part.

Change 232300 had a related patch set uploaded (by Ori.livneh):
Try to make POSTs as transactional as possible

https://gerrit.wikimedia.org/r/232300

Change 232301 had a related patch set uploaded (by Ori.livneh):
Added wfTransactionalTimeLimit() method and applied it

https://gerrit.wikimedia.org/r/232301

Change 232300 merged by jenkins-bot:
Try to make POSTs as transactional as possible

https://gerrit.wikimedia.org/r/232300

Change 232301 merged by jenkins-bot:
Added wfTransactionalTimeLimit() method and applied it

https://gerrit.wikimedia.org/r/232301