[ 
https://issues.apache.org/jira/browse/WICKET-6780?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17099851#comment-17099851
 ] 

Thomas Heigl edited comment on WICKET-6780 at 5/5/20, 12:52 PM:
----------------------------------------------------------------

I forgot to add page and component info to the URL that should be mapped in my 
first benchmark.

This benchmark compares the performance of the improved resource mapper against 
the old mapper when the URL contains page and component info and the url prefix 
does *not* match the mounted resource:
|| Benchmark||Mode||Cnt||Score||Error||Units||
|MapperBenchmark.compatibilityScore|thrpt|5|     2941171,582|± 753730,306|ops/s|
|MapperBenchmark.compatibilityScoreWithPathMatching|thrpt|5|175552130,457|± 
8607428,875|ops/s|

The prefix heuristic is nearly 60 times faster in this case.

 


was (Author: thomas.heigl):
I forgot to add page and component info to the URL that should be mapped in my 
first benchmark.

This benchmark compares the performance of the improved resource mapper against 
the old mapper when the URL contains page and component info and the url prefix 
does *not* match the mounted resource:
|| Benchmark||Mode||Cnt||Score||Error||Units||
|MapperBenchmark.compatibilityScore|thrpt|5|    2941171,582|± 753730,306|ops/s|
|MapperBenchmark.compatibilityScoreWithPathMatching|thrpt|5|175552130,457|± 
8607428,875|ops/s|

The prefix heuristic is nearly 60 times faster in this case.

 

> Improve performance of resource mapping
> ---------------------------------------
>
>                 Key: WICKET-6780
>                 URL: https://issues.apache.org/jira/browse/WICKET-6780
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-core
>    Affects Versions: 8.7.0, 9.0.0-M5
>            Reporter: Thomas Heigl
>            Priority: Major
>         Attachments: image-2020-05-05-10-59-50-624.png
>
>
> {{ResourceMapper}} showed up very prominently in my production profiler:
> !image-2020-05-05-10-59-50-624.png|width=952,height=551!
> For mapping an incoming request to a handler, the {{CompoundRequestMapper}} 
> iterates over all registered mappers and calculates a compatibility score. 
> For resources, this involves extracting the component and page info from the 
> URL. This seems to be quite an expensive operation.
> If a request comes in, Wicket parses the component info for *every* 
> registered resource. In my case, several hundred. It does this, *before* it 
> checks if the request path would even match the requested resource, which 
> would be a much cheaper operation. It has to do so, because it has to remove 
> potential caching information from the URL before applying url matching.
> I have implemented a heuristic that bypasses this check if the initial 
> segments of the resource path do not match the incoming request. E.g.
> A resource is mounted under {{/static/css/my.css}}. The initial segments 
> would be {{static}} and {{css}}. They contain no parameters and do not 
> contain caching information because this information is either encoded in the 
> file name or a query parameter.
> This is currently implemented as a custom {{ResourceMapper}} that I use for 
> all my resources, but it might be a worthy improvement for the default mapper 
> implementation:
> ||Benchmark||Mode||Cnt||Score||Error||Units||
> |MapperBenchmark.compatibilityScore|thrpt|5|  6251028,198|± 1110953,287|ops/s|
> |MapperBenchmark.compatibilityScoreWithPrefixMatching|thrpt|5|13154340,419|± 
> 1435077,659|ops/s|



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to