Giter VIP home page Giter VIP logo

wicket-classpath-preloader's Introduction

Current version: 0.0.1.wicket{7|8}

Classpath prescanning to accelerate Wicket resource loading

Wicket loads its resources (HTML files, properties files, etc) lazily, i.e. on first access. To allow for locale and style overrides, it tries more specific paths first (e.g. FooPage_de_green.html) before trying more generic ones (FooPage.html). This works very well in practice, except on a few systems where classpath/filesystem access is unusually expensive. The symptom of this is that the first request with a locale or style will take tens of seconds longer than expected. Subsequent requests using the same locale or style will not have this problem, since the relevant files will be cached. Some IBM systems seem to exhibit this issue.

If this affects your application, you can trade some memory and some time in application startup for faster first request times. ClassPathPreloader will scan the entire classpath during application startup so that only existing files will actually be accessed. It does this by wrapping Wicket's ClassPathResourceFinders and not letting them proceed with paths known to be invalid.

It uses a constant amount of memory (roughly 600KB), regardless of classpath size, due to using a Bloom Filter with a fixed estimate of 1,000,000 entries. See the javadoc of ClassPathPreloader for more information.

How to use

Do this in your Application.init:

ClassPathPreloader.configure(this);

If you have any custom IResourceFinders, initialize them before this.

Don't use this unless your production system is measurably affected by the symptom described above. To keep development turnaround times low, use it only in DEPLOYMENT mode.

Maven coordinates

<dependency>
    <groupId>de.wicketbuch.extensions</groupId>
    <artifactId>classpath-preloader</artifactId>
    <version>0.0.1.wicket8</version>
</dependency>

Make sure you choose the correct version for the version of Wicket you are using, they are suffixed with .wicket7 and .wicket8 respectively.

This project uses Semantic Versioning, so you can rely on things not breaking within a major version.

wicket-classpath-preloader's People

Contributors

duesenklipper avatar

Watchers

Antonia Schmalstieg avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.