Scaffolding Spring MVC application not using all cores?

This topic contains 7 replies, has 3 voices, and was last updated by Profile photo of Luis Pedro Luis Pedro 1 year, 1 month ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #497050 Reply
    Profile photo of Luis Pedro
    Luis Pedro
    Participant

    Hello,

    Scaffolding a Spring MVC application on our relatively large DB model is an operation that is painfully slow, despite being run on a 16GB/4-core machine with Java on a RAM disk and the workspace on a fast SSD.
    I noticed that while working on the scaffolding, Eclipse is never using more than 25% of the total CPU (i.e., one core).
    – Is there a reason for this?
    – Is there a way to instruct Eclipse to use more cores, and would this impact scaffolding speed?
    – More in general, what are the factors that mostly impact scaffolding times (apart of course from the data model size and complexity)?

    I am running MyEclipse 2016 CI 5 and JDK 1.8.0_101 64-bit on a Windows 10 PC.
    Here’s the vm parameters used in myeclipse.ini:

    Thanks

    #497255 Reply
    Profile photo of support-swapna
    support-swapna
    Moderator

    Luis,

    Sorry that you are seeing this issue. Eclipse/MyEclipse automatically uses all the available cores. I am afraid there is no configuration for Eclipse/MyEclipse to use more cores.

    Can you please clarify if increasing the -Xmx to 4096m make any difference in the scaffolding time?
    As you have 16GB, you can try increasing the -Xmx value to more than 4096m and check if it helps.

    MaxPermSize is deprecated in Java 8 and will be ignored if declared. You can remove it from the myeclipse.ini file.

    The relationship between the tables (ex: One to Many) in the database might also effect the scaffolding performance. How much time does it take for the scaffolding to finish? Please give us more details about the relationship between the tables.

    Apologies for inconvenience caused. Let us know how it works.

    –Swapna
    MyEclipse Support

    #497357 Reply
    Profile photo of Luis Pedro
    Luis Pedro
    Participant

    Hi Swapna,

    increasing the Xmx did not seem to change things much (myeclipse never even seems to use the 4096 I used to have).
    Admittedly, the DB is not the smallest ever. I have 92 tables, most of them have a foreign key to one particular table that holds the “central” entity. I suppose this fact may cause a continuous refactoring of the class materializing that “central entity” during the scaffolding.

    In any case, if you say that MyEclipse should be using all cores by default, I don’t understand why it is constantly below 25% CPU and below the allotted memory, still takes such a long time (in the 40 minutes for a full scaffold). I typically close other applications and leave the PC alone during scaffolding, so available resources are plenty. Shouldn’t it be using more than 25% CPU for example? So the question is still the same, what is the limiting factor that makes the scaffolding process so slow despite the available resources?

    BTW, my DB server is on the LAN, and I have a 1Gb ethernet connection to it, so I don’t suppose this should be a really limiting factor. But I could be wrong. I was thinking to make an experiment by copying the DB to my local machine and trying a completely local scaffolding. Do you think it could change things?

    #497372 Reply
    Profile photo of support-swapna
    support-swapna
    Moderator

    Luis,

    Thank you for the details. I have escalated your concern to the dev team. They will get back to you soon.
    Apologies for inconvenience caused.

    –Swapna
    MyEclipse Support

    #497395 Reply
    Profile photo of Brian Fernandes
    Brian Fernandes
    Moderator

    Luis,

    I believe the bottleneck won’t be the CPU, or other resource contention, it’s more likely to be DB operations over the network. In my experience, these do take more time than you would expect and I believe the fact that you have 92 tables would compound the problem.

    As a test, could you go ahead with your suggestion of copying the DB to your local machine and see how that affects the timing?

    Also, what database/version are you connecting to? If you browse through the tables in the DB Browser view is that as fast as you would expect?

    Best,
    Brian.

    #497453 Reply
    Profile photo of Luis Pedro
    Luis Pedro
    Participant

    Hi Brian,

    I tried replicating the DB locally, and scaffolding from it. It did not improve things, if anything it is even slower (been scaffolding for about one hour now and still going), so the network transfer doesn’t seem to be the culprit. I am leaning towards blaming the actual DB structure (both size and number of relationships). Bad news, as I can’t do much to reduce that.
    On the bright side, I don’t have to rescaffold very often, so with a little bit of planning this should not be a major inconvenient. However, should you get other ideas on what to try, they are welcome.

    I also tried browsing the DB (the one on the server) in the DB Browser, and that does look quick, no significant delay when accessing tables and table details.

    During scaffolding, from what I see in the Progress view, the generation is able to create between 1 and 2 classes per second (I am talking about the classes being put in the “generated” folder). More often one than two, actually. Since there are slightly less than 800 classes being created between all packages, I need in the order of 15 minutes just for the classes; add to that the other generated “stuff” for Spring, and the time spent in the “streaming binary” operation (which I suppose is the reading from the DB?) and the time it seems to take is in the ballpark for what I am experiencing.

    FYI the db is MySQL 5.5.50 on an Ubuntu 14.04 server; MyEclipse 2016 CI 5 is running on a Windows 10 Pro PC with JDK 1.8.0_101 64-bit, Core i7 4Ghz, 16GB RAM. We will in perspective upgrade the MySQL version when we upgrade Ubuntu to the new 16.04 LTS, we’ll see if that does make any difference.

    Thanks for your suggestions, have a nice day.

    #499487 Reply
    Profile photo of Brian Fernandes
    Brian Fernandes
    Moderator

    Luis,

    Apologies for not responding here earlier – certainly doesn’t support my theory that it’s the network latency to blame, and I’m quite surprised.

    From your previous description, I assume you do see some movement in the progress dialog at all times and it’s not just stuck for a long time after which you see a bunch of output?

    So we can try and replicate here, can you tell me exactly how you are initiating the scaffolding, what options you choose and what types of artifacts you are choosing to generate from the scaffolding (Spring MVC, Spring Web Flow, Adobe Flex, …)? You could attach screenshots of the each page in the wizard if that is easier. Have you tried with a minimal set of artifacts to see if that makes any difference – maybe one of the generation options is especially slow for some reason.

    #499496 Reply
    Profile photo of Luis Pedro
    Luis Pedro
    Participant

    Hi Brian,

    thanks for the reply.

    Yes, the progress is constantly moving. Most of the generation time is spent in the “Creating operation model” phase, and the operations names are changing every few seconds. There are just… many. 🙂 Once it gets to the phase where it generates the java classes in the “generated” folder, the generation is almost over.

    Would it help you trying to replicate if I gave you a dump of the DB (without the data, of course)? It might be a while before I get around to preparing that but it should be feasible.

    I am initiating the scaffolding via right click on the project in the MyEclipse Explorer, and choosing “Scaffolding Spring CRUD Application”. I go with scaffolding from Database, using mysql, selecting almost all my tables (there are a few for which I have implemented the DAO manually), and choosing to generate the Spring MVC artifacts only. After the artifact selection just click “Finish”, leaving the remaining options by default.
    Screen captures are too large to attach, so I put them here:
    https://dl.dropboxusercontent.com/u/10487109/Capture-myeclipse.png

Viewing 8 posts - 1 through 8 (of 8 total)
Reply To: Scaffolding Spring MVC application not using all cores?