Optimizations Used by ORM

I teach Java EE, especially JPA, Spring, and Spring MVC. Since I don’t have much experience in large projects, it’s hard to understand what to present to students about ORM optimization.

I am currently presenting some classic optimization tricks:

  • prepared statements (most ORMs implicitly use them by default)
  • first and second level caches
  • "write first, optimize later"
  • You can disable ORM and send SQL commands directly to the database for very frequent, specialized, and expensive queries.

Is there another point that the community sees in another way to optimize ORM? I am particularly interested in DAO templates ...

+3
source share
6 answers

From the point of view of the developer, there are the following optimization options with which he must deal:

  • chattiness ORM DB. , ORM , , , 0,1 1 , , ( , 90% ). SELECT N + 1: ( 1 + count (...) ), , . CRUD - , chattines ( ).
  • . ORM , . API-, SQL, .

, :

  • : API, , . , . , (= ORM DB). ORM , . NHibernate.
  • CRUD: , INSERT, UPDATE DELETE chattines. , ORM.
  • - " " . AFAIK, DataObjects.Net(ORM, ).
  • : , (, , , , .. ). , CRUD: , , . AFAIK, ORM .

" , " ( " , " ).

API, , API ( " " ). , , , , (, , ). , API "SELECT N + 1". , , , ORM.

, .. . , , : , , , (, ). , , ( memcached ..). , , ; API, , .

P.S. .NET, DataObjects.Net ORMeter.NET. , Java, .

+5

N + 1 ? , . ORM n + 1;

+1

Spring Spring MVC, . ++, Java, , UI w.r.t. Spring .

+1

Lazy- loading , , ORM.

, Hibernate , object.collection.count, , SELECT Count(*).

+1

DAO, JPA , ( , Hibernate , ). Spring Roo, , ORM- .

+1

Source: https://habr.com/ru/post/1735711/


All Articles