简体   繁体   中英

Entity framework Slow query performance

I am using Entity framework 6.2.0 with WebAPI hosted on azure app service.

My database is not big with only two tables and I have a simple select query

Account account =  Db.Accounts.Where(p => p.Code == Code && p.PersonId == 
PersonId).Include("Options").FirstOrDefaultAsync();

What i am struggling with is, when I deploy this on azure. and whenever i make the first call to the api which uses above query or when there is a significant gap of few minutes or 1 hour between two calls, Above process takes a long time to complete .almost 20-25 seconds, The next call is in less than a second.

I have confirmed, that it's definitely not my network latency or something else that is slowing this down.

Does anyone have a clue what I can look at?

My entity framework implementation is database-first.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM