39

How NOT to make applications:

- single GET request called rather frequently
- 3304 SELECTs per request
- Some of them lasting ~50ms

Comments
  • 2
    @Jilano Depends :D

    Still better than the case I'm on, since all these SQLs are slowing GET requests to 15-30 seconds. With a single user online
  • 1
    Are these GETs attached to page views? Are customers waiting for these GETs to complete and get processed before they see things on the page?
  • 2
    @bahua GET /calendarEntries

    So yeah, the user has to wait :)

    And that's not all. 90% of those GETs timeout at a gateway layer :D

    sooo yeah. Amazing UX!
  • 0
    @SevenDeadlyBugs I agree.

    The problem in my case is somewhat similar. And different :)

    Developers are using Hibernate as ORM framework. While that GET only executes a single findAllBy.... method of the repository interface, the entity they are fetching has all the possible circular references.

    There are 2 sets of entities in the main Entity. Each set contains a type that back-references to main Entity. Nonetheless each of them have additional nested entities, that also link back to main Entity and intermediate entities.

    To put it simple: all the possible circular references are there :) That explains why Hibernate is losing its mind.

    I'm considering suggesting to split horrible entity into smaller ones and fetch them separately on as-needed basis. And lose those circular references. I am pretty sure that would drop DB calls' count significantly :)
  • 0
    @netikras Not sure I understand the problem as it sounds to me that it's using eager loading where it is not needed and simply using lazy loading would fix your issue
  • 0
    @Senior circular refs are not needed at all there :) and lazy would be pointless as the whole model is transformed to a dto and spit back to the requester immediately. Nothing else is done
  • 1
    @netikras Actually I wrote the wrong way around. Was meaning you should eager and only include what you needed for the dto.

    Anyways, sounds like some refactoring is needed :)
  • 1
    @Senior with that I agree :)
  • 0
    Let me tell you about what I've seen this week: there's a Form as first Element in the body. The form uses Post as method. Except for one type of link to a subsite in a list every interaction is handled by JS, basically submiting the form. Oh, did I say, it takes over 1000 ms to load? (Both Post and Get)...
Add Comment