Currently org.apache.wicket.Session#sequence and org.apache.wicket.Session#pageId are primitive ints, non-volatile.
They are accessed only in their getter methods where they are read and incremented. To make sure their values are correct the getter methods are synchronized on the session instance. This synchronization may lead to slower execution of the getter when another thread/request does something slower in another synchronized method of Session.
Using AtomicInteger should improve here.
Other fields of Session like locale and style are not synchronized and different threads may read old value for them. Using AtomicReference should improve this.
Some special boolean fields like 'dirty' and 'sessionInvalidated' should be made volatile to avoid dirty reads.
WICKET-5473 org.apache.wicket.Session#nextPageId() and org.apache.wicket.Session#nextSequenceValue() call #dirty() only for bound sessions. The check whether the session is bound or not should really be in #dirty() itself.