Hi Folks,
This has been a burning question and issue with almost all .Net developers -
I also faced this and researched for a long time and have read so many blogs and posts about this issue stating that entity framework is a bottle neck in terms of performance.
Yes, that's absolutely correct if you don't use it properly and without any vision of your DB size and the operations which you would need to perform on the data.
Few important tips -
# Use DBContext wisely as this can completely blow off your application performance.
# DO NOT select all columns and fetch only required columns from tables
# Use relationships intelligently
# Use lazy loading and eager loading wherever required per situation
# Ignore costly queries which fetches too many rows from DB, instead use Stored Procedures if you can
# Identify slow running queries using EF Profiler, this is a very good tool to get the details
# Verify that DB connections are properly closed and disposed
# Verify all DB objects including parameters are being disposed properly
# Use "Using" while using DB connections
# Don't span DBContext for a long time
# Use LINQ properly
# Make use of joins
# Use data filters and fetch limited rows from DB itself rather than filtering them on client side
# Use DB side paging while fetching and displaying large row set
# Don't hesitate using stored procedure wherever needed
# Use views if you have large data in tables
# Tools which be used to fine tune your EF queries - EF profiler, Server dumps, Query debugger, Performance monitors, VS Performance analyzer
# Continuously perform load and performance testing of your application rather than doing it at the end of the project
Happy programming
This has been a burning question and issue with almost all .Net developers -
I also faced this and researched for a long time and have read so many blogs and posts about this issue stating that entity framework is a bottle neck in terms of performance.
Yes, that's absolutely correct if you don't use it properly and without any vision of your DB size and the operations which you would need to perform on the data.
Few important tips -
# Use DBContext wisely as this can completely blow off your application performance.
# DO NOT select all columns and fetch only required columns from tables
# Use relationships intelligently
# Use lazy loading and eager loading wherever required per situation
# Ignore costly queries which fetches too many rows from DB, instead use Stored Procedures if you can
# Identify slow running queries using EF Profiler, this is a very good tool to get the details
# Verify that DB connections are properly closed and disposed
# Verify all DB objects including parameters are being disposed properly
# Use "Using" while using DB connections
# Don't span DBContext for a long time
# Use LINQ properly
# Make use of joins
# Use data filters and fetch limited rows from DB itself rather than filtering them on client side
# Use DB side paging while fetching and displaying large row set
# Don't hesitate using stored procedure wherever needed
# Use views if you have large data in tables
# Tools which be used to fine tune your EF queries - EF profiler, Server dumps, Query debugger, Performance monitors, VS Performance analyzer
# Continuously perform load and performance testing of your application rather than doing it at the end of the project
Happy programming