Reviewing the different session managers trying to improve its performance I notice that the function TROCustomSessionManager.CreateSession(const aSessionID: TGUID): TROSession;
has this line on it
(GetSessionCount>=MaxSessions) and (MaxSessions>0)
I’ll recommend to change the ordering so there is at least a short circuit evaluation (if set) so if MaxSessions = -1 (we dont care about how many sessions) the getsessioncount will not be executed.
That’s a trip to the db or a different service for no reason. Better yet will be to check it disregarding so if the switch is not set it will still not do the trip.