Base solution for your next web application
Open Closed

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


0
npdevs created

Hello.

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.

AbpUserStore.cs:

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 (https://support.aspnetzero.com/QA/Questions/10764/Bad-performance-due-to-AbpUserTokens-table, https://support.aspnetzero.com/QA/Questions/10764/Bad-performance-due-to-AbpUserTokens-table) 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. Asp.net zero 12.0


3 Answer(s)