Edgewall Software
Modify

Opened 19 years ago

Closed 19 years ago

Last modified 19 years ago

#3067 closed task (fixed)

p.e.c. slowness issues after 0.10dev upgrade

Reported by: Christian Boos Owned by: Jonas Borgström
Priority: highest Milestone:
Component: general Version: devel
Severity: critical Keywords: pec
Cc: jonas@… Branch:
Release Notes:
API Changes:
Internal Changes:

Description

As many may have noticed, there are some issues on this Trac after the upgrade to 0.10dev.

While usually 0.10dev works quite well, we nevertheless have some issues here that are currently being investigated.

This ticket can be used to discuss the issue and for gathering related data.

PS: I just had a database is locked error while submitting this the first time :)

Attachments (7)

create_newticket.png (44.0 KB ) - added by Christian Boos 19 years ago.
These are the timings of the first failed ticket creation attempt (numbers are milliseconds). Created by the Tamper Data extension for Firefox.
check_timeline_request.png (62.9 KB ) - added by Christian Boos 19 years ago.
Just after the failed attempt (ending up in a database is locked error), I checked the timeline …
check_latest_changeset.png (37.5 KB ) - added by Christian Boos 19 years ago.
Then I wanted to have a look at the latest changeset…
view_ticket_3067.2.png (48.8 KB ) - added by Christian Boos 19 years ago.
And finally, a graph of the timing of viewing #3067 just after I completed the last three uploads, as I noticed that the server is reasonably fast now (second upload attempt for this one, the first never completed…)
load_test.2.png (33.0 KB ) - added by Christian Boos 19 years ago.
After some changes on p.e.c, here's the result of a load test (3 wiki pages, 4 attachement previews, 1 ticket view and 4 timelines)
session.patch (13.5 KB ) - added by Jonas Borgström 19 years ago.
A more optimized session schema (updated).
session3.patch (23.3 KB ) - added by Jonas Borgström 19 years ago.
A new version of the patch with a more normalized table schema

Download all attachments as: .zip

Change History (12)

by Christian Boos, 19 years ago

Attachment: create_newticket.png added

These are the timings of the first failed ticket creation attempt (numbers are milliseconds). Created by the Tamper Data extension for Firefox.

by Christian Boos, 19 years ago

Attachment: check_timeline_request.png added

Just after the failed attempt (ending up in a database is locked error), I checked the timeline …

by Christian Boos, 19 years ago

Attachment: check_latest_changeset.png added

Then I wanted to have a look at the latest changeset…

by Christian Boos, 19 years ago

Attachment: view_ticket_3067.2.png added

And finally, a graph of the timing of viewing #3067 just after I completed the last three uploads, as I noticed that the server is reasonably fast now (second upload attempt for this one, the first never completed…)

comment:1 by Christian Boos, 19 years ago

Keywords: pec added

The first graph shows some long latency for the main create request, which fails (500) after 22 seconds. It might be a normal database lock…

But what I don't understand is that all the first three graphs show a very unusual latency for the static resources, the /trac_chrome/ ones, but also the root /gfx/ or /css/. That's quite surprising. In the third graph (attachment:check_latest_changeset.png), we see in particular that /trac_chrome/css/trac.css takes 5 minutes and /css/header.css takes 10 minutes to load…

Now, when things went back to "normal" (attachment:view_ticket_3067.2.png),

(by the way, if there's a .2, it's that the first upload has at least partially succeeded: the file was received and written on the filesystem, but the attachment entry couldn't be written in the db… certainly another db lock).

the timings seems pretty decent: 406 ms for the main request, about 170ms for each secondary request. For those, there seem to be at first a sequential access pattern, then 8 or so are started simultaneously and finish also in a roughly sequential way, being consistent with a 170ms access time.

So it seems that after a while, there are no available server thread available, all must be caught in some kind of database lock, waiting for a timeout. Even the requests for secondary resources can then take an enormous amount of time (graph 3) as apache control process must wait for a child to come back…

I think the problem is two fold:

  • those static resources should be cached by the browser, and not reloaded every time
  • the MaxClients parameter is too low (or there's some other misconfiguration)

Plus the fact that we have too many database locks, of course.

by Christian Boos, 19 years ago

Attachment: load_test.2.png added

After some changes on p.e.c, here's the result of a load test (3 wiki pages, 4 attachement previews, 1 ticket view and 4 timelines)

comment:2 by Jonas Borgström, 19 years ago

The slowness seems to come from the way sessions are stored and accessed. The session table on p.e.c contains more than 240k rows. This in combination with the lack of indicies on this table resulted in very poor performance of a couple of queries, especially Env.get_known_users and the query that purges old sessions.

The solution I'm proposing is to use a slightly less normalized session table schema where the "last_visit" variable is stored in a separate column (time). The table will also have indicies on the "sid", "time" and "authenticated" columns.

The patch also adds an index for the time column of the ticket_change table.

attachment:session.patch

by Jonas Borgström, 19 years ago

Attachment: session.patch added

A more optimized session schema (updated).

by Jonas Borgström, 19 years ago

Attachment: session3.patch added

A new version of the patch with a more normalized table schema

comment:3 by Jonas Borgström, 19 years ago

Resolution: fixed
Status: newclosed

The attachment:session3.patch is now applied so this issue is hopefully resolved.

comment:4 by Jonas Borgström, 19 years ago

just a test, ignore

comment:5 by Jonas Borgström, 19 years ago

Cc: jonas@… added

More testing

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jonas Borgström.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jonas Borgström to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.