Base solution for your next web application
Open Closed

Bad performance due to AbpUserTokens table / the purpose of AbpUserTokens table data #11436

npdevs created


I found, that issuing a new token takes too much time when AbpUserTokens table has more than a few thousands records. This is caused by the way UserRepository adds new record to the table.


public virtual async Task AddTokenValidityKeyAsync(...)
            await UserRepository.EnsureCollectionLoadedAsync(user, u => u.Tokens, cancellationToken);
            user.Tokens.Add(new UserToken(user, TokenValidityKeyProvider, tokenValidityKey, null, expireDate));

In the tickets with similar issue (, the suggesting was to clear the table from time to time. But what is the purpose of the stored information at all? Where is the data from this table used? Is it possible to skip saving tokens info at all and what side effects will I get then?

P.S. zero 12.0

5 Answer(s)