Closed
Bug 113163
Opened 24 years ago
Closed 24 years ago
Performance problem at downloading
Categories
(Core Graveyard :: File Handling, defect, P3)
Tracking
(Not tracked)
VERIFIED
FIXED
mozilla0.9.9
People
(Reporter: ak, Assigned: law)
References
Details
(Keywords: perf)
Attachments
(4 files)
|
1.91 KB,
patch
|
gordon
:
review+
darin.moz
:
superreview+
|
Details | Diff | Splinter Review |
|
77.28 KB,
patch
|
Details | Diff | Splinter Review | |
|
3.18 KB,
patch
|
Details | Diff | Splinter Review | |
|
3.18 KB,
patch
|
Details | Diff | Splinter Review |
When downloading big binary files (50+MB) at DSL speed (40-80kb/s) mozilla becomes
very slow and eats a lot of CPU time (upto 90% on a 900mhz athlon)
Some profiling showed that nsStorageTransport::AppendSegment eat a lot
of CPU time walking segment lists.
The attached patch fixes the segment list to have a tail pointer, which makes
mozilla use a lot less (but still too much) CPU time during download. It
is now at about 30% of CPU during downloading a random big file from the network.
I attached also a profile log generated by oprofile after the
nsStorageTransport::AppendSegment O(1) patch was added, with 30% CPU usage.
It shows that a lot of time is spent in memcpy() and
NSPR_GetCurrentThread() and accessing of thread local pthread data.
(the search_by_key showing up in the kernel is in reiserfs and does not seem to
be directly caused by mozilla) A little bit behind comes nsCachedStyleData(),
GetStyleData(). I suspect the are caused by updating the progress window,
because the downloaded data should not require any style processing. This
updating probably could be optimized too. For more details see the attached
profile log.
| Reporter | ||
Comment 1•24 years ago
|
||
| Reporter | ||
Comment 2•24 years ago
|
||
Here is the oprofile log. It shows some other candidates for speeding
up downloading (e.g. thread handling and the updating of the progress
window)
Updated•24 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment 3•24 years ago
|
||
darin, law: This yours?
We have other bugs on the download window updating too often, and I know I saw a
bug in the last few days about downloads being effectivly throtteld, but I cna't
find it now.
Comment 4•24 years ago
|
||
I don't know enough of this to do a review but two comments:
if (!mSegments) {
mSegments = aSegment;
mSegmentsLast = aSegment;
} else {
mSegmentsLast->next = aSegment;
mSegmentsLast = aSegment;
}
Move mSegmentsLast out of the if?
nsSegment *mSegments;
+ nsSegment *mSegmentsLast;
nsSegment *mWriteSegment;
Align this like the other?
Comment 5•24 years ago
|
||
the real problem here is that we shouldn't be storing such large files in the
memory cache. something needs to be regulating this.
that being said, i do like the sound of the nsStorageTransport patch :)
-> me
Assignee: neeti → darin
Comment 7•24 years ago
|
||
gordon: we have other bugs about not putting such large stuff in the memory
cache, right?
| Reporter | ||
Comment 9•24 years ago
|
||
With this patch and the O(1) append patch in the same bug I have
mozilla eating around 6-10% of my CPU during downloading.
Bas
ically it tries to do everything related to window updating as
lazily as possible.
It is a kind of an hack; it would be better to add some way to whoever calls
onProgress() to call it a bit less often.
After that patch the far most prominent offenders in the profile log are
PR_GetCurrentThread/NS_CurrentThread(). One way to fix them at least
on Linux would be to use user stacks in pthreads (requires new glibc),
allocate the stacks privately and put the nspr thread data onto the bottom
of an aligned stack. Then PR_GetCurrentThread could be a simple and with
the stack pointer and shrink to ~three instructions.
Second offender in a profile of a download (in order of prominence)
libgkcontent.so RETIRED_INSNS nsCachedStyleData::GetStyleData(nsStyleStructID
co
Not sure how to fix that.
malloc()
NS_CheckThreadSafe() (may be because I'm using a debugging build.
At least it should probably cache the environment variable)
js_Interpret() - probably needs a more efficient onProgress() handler to fix
convertTrueColor_generic() from libwraster()
No idea why it needs that for a download
PR_Unlock
index() from libc. Something doing too many string operations. Could
be the getenv() from NS_CheckThreadSafe()
| Reporter | ||
Comment 10•24 years ago
|
||
With this patch and the O(1) append patch in the same bug I have
mozilla eating around 6-10% of my CPU during downloading.
Bas
ically it tries to do everything related to window updating as
lazily as possible.
It is a kind of an hack; it would be better to add some way to whoever calls
onProgress() to call it a bit less often.
After that patch the far most prominent offenders in the profile log are
PR_GetCurrentThread/NS_CurrentThread(). One way to fix them at least
on Linux would be to use user stacks in pthreads (requires new glibc),
allocate the stacks privately and put the nspr thread data onto the bottom
of an aligned stack. Then PR_GetCurrentThread could be a simple and with
the stack pointer and shrink to ~three instructions.
Second offender in a profile of a download (in order of prominence)
libgkcontent.so RETIRED_INSNS nsCachedStyleData::GetStyleData(nsStyleStructID
co
Not sure how to fix that.
malloc()
NS_CheckThreadSafe() (may be because I'm using a debugging build.
At least it should probably cache the environment variable)
js_Interpret() - probably needs a more efficient onProgress() handler to fix
convertTrueColor_generic() from libwraster()
No idea why it needs that for a download
PR_Unlock
index() from libc. Something doing too many string operations. Could
be the getenv() from NS_CheckThreadSafe()
Comment 11•24 years ago
|
||
gordon: i would assume that data is going into the memory cache because the user
has set their disk cache to zero size.
Comment 12•24 years ago
|
||
I didn't see where the report said the user had set their disk cache to zero...
Comment 13•24 years ago
|
||
reporter: what URL are you loading that demonstrates this problem? what are
your cache preferences?
| Reporter | ||
Comment 14•24 years ago
|
||
Indeed my disk cache size is set to 0.
(doubt that even a 20MB disk cache would have helped with a 400MB download though)
I downloaded from several different URLs (mostly private) They all showed the
same CPU time eating.
Comment 15•24 years ago
|
||
will this patch/change be at all useful after the download manager suppose to land?
| Reporter | ||
Comment 16•24 years ago
|
||
Unless the download manager contains a new cache implementation the patch
to fix the memory cache list insertion should still apply.
The javascript optimization may not anymore.
| Assignee | ||
Comment 17•24 years ago
|
||
The .js file in the patch isn't used. The code you want is in
mozilla/embedding/components/ui/progressDlg/nsProgressDlg.js, I think.
Comment 18•24 years ago
|
||
Darin? Netwerk buddies? This looks like a slam-dunk here, and while there's been
a lot of commentary about the cache settings, nobody but Daniel has said word
one about the patch itself. Are there changes needed, other than the ones
Daniel has suggested?
(Don't like to see free performance patches rotting on the vine for weeks at a
time, but I'm funny that way.)
Comment 19•24 years ago
|
||
Comment on attachment 60097 [details] [diff] [review]
patch to fix nsStorageTransport performance problem
>Index: nsStorageTransport.h
> nsSegment *mSegments;
>+ nsSegment *mSegmentsLast;
patch looks good. indentation problem here, otherwise sr=darin.
Attachment #60097 -
Flags: superreview+
Comment 20•24 years ago
|
||
i can take care of landing the nsStorageTransport changes. for the JS changes,
i think i'm going to reassign this bug to xpapps.
Comment 21•24 years ago
|
||
Comment on attachment 60097 [details] [diff] [review]
patch to fix nsStorageTransport performance problem
r=gordon if the changes from comment #4 are factored in.
Attachment #60097 -
Flags: review+
Comment 22•24 years ago
|
||
gordon: agreed... thx for the code review. i'll check this in once the tree opens.
Status: NEW → ASSIGNED
Priority: -- → P3
Target Milestone: --- → mozilla0.9.9
Comment 23•24 years ago
|
||
checked in attachment 60097 [details] [diff] [review].
reassigning to xpapps for the JS optimizations.
Assignee: darin → trudelle
Status: ASSIGNED → NEW
Component: Networking → XP Apps
QA Contact: benc → sairuh
| Assignee | ||
Comment 25•24 years ago
|
||
The JS patches are to files that are no longer used.
There are differences between the patched file and the progress dialog that is
currently in use:
http://lxr.mozilla.org/seamonkey/source/embedding/components/ui/progressDlg/nsProgressDlg.js#80
I don't think that the changes in the patch apply to the current code.
I'm marking this fixed, to account for the back-end changes having gone in.
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Comment 26•24 years ago
|
||
So are you saying that the problem that the JS changes addressed is no longer
present, or are you just closing this bug because the patch doesn't apply?
(IOW: are window updates throttled?)
(Neither the reporter nor the Keeper of the Back-End thought it was finished
when the back-end changes went in, which is an interesting datapoint.)
| Reporter | ||
Comment 27•24 years ago
|
||
(as the original patch creator) It's fine for me to drop the javascript
change. It was only a **** attempt at my part to make some of
the top profile log contenders faster, but I don't think it made
that much difference anyways and I posted it just for completeness.
| Assignee | ||
Comment 28•24 years ago
|
||
Sorry, Mike. My use of "apply" was ambiguous. I meant that the changes
wouldn't appear to have any performance impact in context of the current
implementation. I'm not sure how much difference they made in the old
implementation, as Andi seems to confirm.
Comment 29•24 years ago
|
||
rs vrfy. more recent issues should be filed as new bugs...
Status: RESOLVED → VERIFIED
Updated•10 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•