Performance tuning an Object-Relational Mapper (ORM)

Post on 05-Dec-2014

723 views 0 download

description

ORMs have become a standard tool, though they can shield us from thinking about what's really happening with our database. It is easy and common to inadvertently have the ORM inefficiently interact with the database, if you're not aware of how key concepts should be applied in different scenarios. Some of the most common performance problems in business applications today stem from misuse of the ORM. We'll go over key concepts to be aware of, that apply to the Entity Framework and Nhibernate, such as table mapping strategies and lazy/eager loading scenarios. We'll also cover simple profiling to get at the heart of ORM performance issues on a .NET project.

Transcript of Performance tuning an Object-Relational Mapper (ORM)

Performance Tuning an Object-Relational MapperKey concepts and approaches

ORMs are useful

Your messy code

My slick ORM

It’s not that easy

IMPACT

#ORMHate

Why care about how they work?

Why care about performance issues?

The main performance concerns

Too little Lazy. Too lazy.

Too long Elapsed time.

Too much Eager. Too eager.

Situations Grids

1. Profile Common Scenarios

Tools Profilers

Tracing (i.e. EFTracingProvider)

LinqPad

Log

Free Profilers Down to business

Premium Profilers See ORM contexts

Code that generates SQL easier to see

Bells & whistles (query plans, rows,

2. Optimize queries

3. Eager/lazy settings

4. And more