Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1100197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:50:41+00:00 2026-05-17T00:50:41+00:00

I was asked to have a look at a legacy EJB3 application with significant

  • 0

I was asked to have a look at a legacy EJB3 application with significant performance problems. The original author is not available anymore so all I’ve got is the source code and some user comments regarding the unacceptable performance. My personal EJB3 skill are pretty basic, I can read and understand the annotated code but that’s all until know.

The server has a database, several EJB3 beans (JPA) and a few stateless beans just to allow CRUD on 4..5 domain objects for remote clients. The client itself is a java application. Just a few are connected to the server in parallel. From the user comments I learned that

  • the client/server app performed well in a LAN
  • the app was practically unusable on a WAN (1MBit or more) because read and update operations took much too long (up to several minutes)

I’ve seen one potential problem – on all EJB, all relations have been defined with the fetching strategy FetchType.EAGER. Would that explain the performance issues for read operations, is it advisable to start tuning with the fetching strategies?

But that would not explain performance issues on update operations, or would it? Update is handled by an EntityManager, the client just passes the domain object to the manager bean and persisting is done with nothing but manager.persist(obj). Maybe the domain objects that are sent to the server are just too big (maybe a side effect of the EAGER strategy).

So my actual theory is that too many bytes are sent over a rather slow network and I should look at reducing the size of result sets.

From your experience, what are the typical and most common coding errors that lead to performance issues on CRUD operations, where should I start investigating/optimizing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T00:50:41+00:00Added an answer on May 17, 2026 at 12:50 am

    On all EJB, all relations have been defined with the fetching strategy FetchType.EAGER. Would that explain the performance issues for read operations?

    Depending on the relations betweens classes, you might be fetching much more (the whole database?) than actually wanted when retrieving entities?

    is it advisable to start tuning with the fetching strategies?

    I can’t say that making all relations EAGER is a very standard approach. To my experience, you usually keep them lazy and use “Fetch Joins” (a type of join allowing to fetch an association) when you want to eager load an association for a given use case.

    But that would not explain performance issues on update operations, or would it?

    It could. I mean, if the app is retrieving a big fat object graph when reading and then sending the same fat object graph back to update just the root entity, there might be a performance penalty. But it’s kinda weird that the code is using em.persist(Object) to update entities.

    From your experience, what are the typical and most common coding errors that lead to performance issues on CRUD operations, where should I start investigating/optimizing?

    The obvious ones include:

    1. Retrieving more data than required
    2. N+1 requests problems (bad fetching strategy)
    3. Poorly written JPQL queries
    4. Non appropriate inheritance strategies
    5. Unnecessary database hits (i.e. lack of caching)

    I would start with writing some integration tests or functional tests before touching anything to guarantee you won’t change the functional behavior. Then, I would activate SQL logging and start to look at the generated SQL for the major use cases and work on the above points.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have been asked to look into a fully open source solution for a
I have been asked to audit any/all changes in a MySQL table. Does anyone
I have been asked to provide information on available techniques for assessing our current,
I'm refactoring legacy C++ system to SOA using gSoap. We have some performance issues
I have asked this before, but the more I look at other code examples
I have asked this question countless times on various forums. Ultimately all I need
I have asked a similar question before, but I didn't have a firm grasp
Previously I have asked to strip text from a field and convert it to
This is a continuation question from a previous question I have asked I now
I have been asked to lend a hand on a hobby project that a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.