You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@abdera.apache.org by James M Snell <ja...@gmail.com> on 2007/11/07 06:23:02 UTC

Performance improvements: MimeType

Currently, we are using the Java Activation Framework MimeType class.
Currently, when first used, that class takes anywhere between 90-300 ms
to init.  I have an alternative implementation that implements pretty
much the same set of operations that takes between 10-20 ms to init.
After the JAF version is init'd, operations on the JAF MimeType take
around 1ms. Operations on my new MimeType take 2ms.  So we save a lot in
 the init, and lose 1ms afterwards.

There are a few additional differences: my MimeType is more forgiving
and allows characters that are not strictly allowed in MimeType's...
this generally should not be a problem.  The match algorithm implemented
by mine seems to be faster.

The MimeType class is not used extensively, but it's init time does have
an overall impact on performance.  It's not a big difference but every
little bit counts.

Any objections to switching?

- James

Re: Performance improvements: MimeType

Posted by James M Snell <ja...@gmail.com>.
Dan Diephouse wrote:
> Rereading my message, I think I might of said one thing but meant
> another. What I really meant was, MimeType isn't one of those classes
> that is used across java projects. So using the JAF MimeType doesn't
> really buy us much and I don't see any issue with replacing it.
> 

Heh... why didn't you say so! ;-)

> BTW, 20-30 ms seems like an awfully long time... Are you running -server
> -XX:ParallelGC, letting the server warm up, etc?
> 

No.  These informal benchmarks are based on "cold bore" tests running
within Eclipse.  Later this week I plan on running more detailed
end-to-end profiles.

- James

Re: Performance improvements: MimeType

Posted by Chris Berry <ch...@gmail.com>.
FWIW, we did a lot of profiling recently of Abdera (0.3.0) w/ Yourkit.
And the low hanging fruit appeared to be allowing for streaming the  
content (in our case just an XML doc) to/from the browser.
I did start to look into implementing this for Abdera, but other work  
issues have intervened...
Cheers,
-- Chris 

On Nov 7, 2007, at 11:11 AM, James M Snell wrote:

> In continued testing, the JAF impl outperforms my version in long run
> tests (average runtime of 100000 repeated operations).  I'm going to
> leave things as they are for now and focus on other areas, but I'm  
> going
> to return to this and see what else I can optimize.
>
> - James
>
> Dan Diephouse wrote:
>> Argh, I'm not having very good luck today as I think I misquoted you.
>> You said "Currently, when first used, that class takes anywhere  
>> between
>> 90-300 ms to init." Why does the first init even matter? It should be
>> the init after the JVM has warmed up that we care about.
>>
>> It might be worth getting an open source YourKit license and doing  
>> some
>> profiling of the server under load with that.
>>
>> - Dan
>>
>> Dan Diephouse wrote:
>>> Rereading my message, I think I might of said one thing but meant
>>> another. What I really meant was, MimeType isn't one of those  
>>> classes
>>> that is used across java projects. So using the JAF MimeType doesn't
>>> really buy us much and I don't see any issue with replacing it.
>>>
>>> BTW, 20-30 ms seems like an awfully long time... Are you running
>>> -server -XX:ParallelGC, letting the server warm up, etc?
>>>
>>> - Dan
>>>
>>> James M Snell wrote:
>>>> Considering the fact that we'd still have the dependency on JAF  
>>>> because
>>>> of Axiom, there likely isn't a huge difference.  I'll hold on to  
>>>> the new
>>>> impl class as an option (only took about 30 minutes to implement  
>>>> and
>>>> test) and I'll be continuing my sweep through the rest of the  
>>>> code to
>>>> find other bottle necks.
>>>>
>>>> - James
>>>>
>>>> Dan Diephouse wrote:
>>>>
>>>>> [snip]
>>>>> Seeing that MimeType isn't one of those classes that is really  
>>>>> widely
>>>>> used I don't think it matters too much.
>>>>>
>>>>> Other ugly options: fix the MimeType in geronimo and have  
>>>>> people use
>>>>> that jar. Or, extend MimeType and override all the methods. :-)
>>>>>
>>>>> - Dan
>>>>>
>>>>>
>>>
>>>
>>
>>

S'all good  ---   chriswberry at gmail dot com




Re: Performance improvements: MimeType

Posted by James M Snell <ja...@gmail.com>.
In continued testing, the JAF impl outperforms my version in long run
tests (average runtime of 100000 repeated operations).  I'm going to
leave things as they are for now and focus on other areas, but I'm going
to return to this and see what else I can optimize.

- James

Dan Diephouse wrote:
> Argh, I'm not having very good luck today as I think I misquoted you.
> You said "Currently, when first used, that class takes anywhere between
> 90-300 ms to init." Why does the first init even matter? It should be
> the init after the JVM has warmed up that we care about.
> 
> It might be worth getting an open source YourKit license and doing some
> profiling of the server under load with that.
> 
> - Dan
> 
> Dan Diephouse wrote:
>> Rereading my message, I think I might of said one thing but meant
>> another. What I really meant was, MimeType isn't one of those classes
>> that is used across java projects. So using the JAF MimeType doesn't
>> really buy us much and I don't see any issue with replacing it.
>>
>> BTW, 20-30 ms seems like an awfully long time... Are you running
>> -server -XX:ParallelGC, letting the server warm up, etc?
>>
>> - Dan
>>
>> James M Snell wrote:
>>> Considering the fact that we'd still have the dependency on JAF because
>>> of Axiom, there likely isn't a huge difference.  I'll hold on to the new
>>> impl class as an option (only took about 30 minutes to implement and
>>> test) and I'll be continuing my sweep through the rest of the code to
>>> find other bottle necks.
>>>
>>> - James
>>>
>>> Dan Diephouse wrote:
>>>  
>>>> [snip]
>>>> Seeing that MimeType isn't one of those classes that is really widely
>>>> used I don't think it matters too much.
>>>>
>>>> Other ugly options: fix the MimeType in geronimo and have people use
>>>> that jar. Or, extend MimeType and override all the methods. :-)
>>>>
>>>> - Dan
>>>>
>>>>     
>>
>>
> 
> 

Re: Performance improvements: MimeType

Posted by Dan Diephouse <da...@mulesource.com>.
Argh, I'm not having very good luck today as I think I misquoted you. 
You said "Currently, when first used, that class takes anywhere between 
90-300 ms to init." Why does the first init even matter? It should be 
the init after the JVM has warmed up that we care about.

It might be worth getting an open source YourKit license and doing some 
profiling of the server under load with that.

- Dan

Dan Diephouse wrote:
> Rereading my message, I think I might of said one thing but meant 
> another. What I really meant was, MimeType isn't one of those classes 
> that is used across java projects. So using the JAF MimeType doesn't 
> really buy us much and I don't see any issue with replacing it.
>
> BTW, 20-30 ms seems like an awfully long time... Are you running 
> -server -XX:ParallelGC, letting the server warm up, etc?
>
> - Dan
>
> James M Snell wrote:
>> Considering the fact that we'd still have the dependency on JAF because
>> of Axiom, there likely isn't a huge difference.  I'll hold on to the new
>> impl class as an option (only took about 30 minutes to implement and
>> test) and I'll be continuing my sweep through the rest of the code to
>> find other bottle necks.
>>
>> - James
>>
>> Dan Diephouse wrote:
>>  
>>> [snip]
>>> Seeing that MimeType isn't one of those classes that is really widely
>>> used I don't think it matters too much.
>>>
>>> Other ugly options: fix the MimeType in geronimo and have people use
>>> that jar. Or, extend MimeType and override all the methods. :-)
>>>
>>> - Dan
>>>
>>>     
>
>


-- 
Dan Diephouse
MuleSource
http://mulesource.com | http://netzooid.com/blog


Re: Performance improvements: MimeType

Posted by Dan Diephouse <da...@mulesource.com>.
Rereading my message, I think I might of said one thing but meant 
another. What I really meant was, MimeType isn't one of those classes 
that is used across java projects. So using the JAF MimeType doesn't 
really buy us much and I don't see any issue with replacing it.

BTW, 20-30 ms seems like an awfully long time... Are you running -server 
-XX:ParallelGC, letting the server warm up, etc?

- Dan

James M Snell wrote:
> Considering the fact that we'd still have the dependency on JAF because
> of Axiom, there likely isn't a huge difference.  I'll hold on to the new
> impl class as an option (only took about 30 minutes to implement and
> test) and I'll be continuing my sweep through the rest of the code to
> find other bottle necks.
>
> - James
>
> Dan Diephouse wrote:
>   
>> [snip]
>> Seeing that MimeType isn't one of those classes that is really widely
>> used I don't think it matters too much.
>>
>> Other ugly options: fix the MimeType in geronimo and have people use
>> that jar. Or, extend MimeType and override all the methods. :-)
>>
>> - Dan
>>
>>     


-- 
Dan Diephouse
MuleSource
http://mulesource.com | http://netzooid.com/blog


Re: Performance improvements: MimeType

Posted by James M Snell <ja...@gmail.com>.
Considering the fact that we'd still have the dependency on JAF because
of Axiom, there likely isn't a huge difference.  I'll hold on to the new
impl class as an option (only took about 30 minutes to implement and
test) and I'll be continuing my sweep through the rest of the code to
find other bottle necks.

- James

Dan Diephouse wrote:
> [snip]
> Seeing that MimeType isn't one of those classes that is really widely
> used I don't think it matters too much.
> 
> Other ugly options: fix the MimeType in geronimo and have people use
> that jar. Or, extend MimeType and override all the methods. :-)
> 
> - Dan
> 

Re: Performance improvements: MimeType

Posted by Dan Diephouse <da...@mulesource.com>.
James M Snell wrote:
> Currently, we are using the Java Activation Framework MimeType class.
> Currently, when first used, that class takes anywhere between 90-300 ms
> to init.  I have an alternative implementation that implements pretty
> much the same set of operations that takes between 10-20 ms to init.
> After the JAF version is init'd, operations on the JAF MimeType take
> around 1ms. Operations on my new MimeType take 2ms.  So we save a lot in
>  the init, and lose 1ms afterwards.
>
> There are a few additional differences: my MimeType is more forgiving
> and allows characters that are not strictly allowed in MimeType's...
> this generally should not be a problem.  The match algorithm implemented
> by mine seems to be faster.
>
> The MimeType class is not used extensively, but it's init time does have
> an overall impact on performance.  It's not a big difference but every
> little bit counts.
>
> Any objections to switching?
>
> - James
>   
Seeing that MimeType isn't one of those classes that is really widely 
used I don't think it matters too much.

Other ugly options: fix the MimeType in geronimo and have people use 
that jar. Or, extend MimeType and override all the methods. :-)

- Dan

-- 
Dan Diephouse
MuleSource
http://mulesource.com | http://netzooid.com/blog