• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Interview question on performance tuning

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ques1. If there is a code(method) inside a jar and it takes 10 seconds to do business processing, then how can we performance tune it? So there are 10 integer values which the method needs to process, and it will take 10s and 10 = 100s which is too much time and how can it be reduced to say 10secs or 20 secs.

ques2: I have a flat table which has all details of Employee object. Now I search all "Vivek" in the employee table and want to show on UI, which datastructure should I use?
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Well... What was your initial answer? What follow up did you do for the questions? Etc.

Henry
 
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That first one is almost certainly (if it's as worded) something to see how you would go about solving a problem with very little initial data.
 
Master Rancher
Posts: 4806
72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, you almost certainly need to ask more questions or suggest more strategies to find out more info on this performance problem. Some ideas:

Is there documentation for the library? Look there to see if you can find more information. Can you Google more information about it? What about a search like "FooLibraryName performance problems"? Are there other people out there who have had similar problems? What did they do to solve them? If it's proprietary code, or not widely known to the public, can you contact the people who wrote it? Do they have any ideas?

Do you have access to the source code for the library? Or, can you use something like IntelliJ to decompile the source for you?

Look at the other methods and classes in the library. Are there other ways to get the information you need? E.g. perhaps there's some sort of "bulk" method that lets you process a collection of numbers simultaneously, rather than one at a time.

Can you use a performance profiler to get more information about which methods, exactly, are really taking up the time?

Can you reproduce the problem? On you own machine? In a relatively simple project setup, maybe with just the one outside jar file, and some test code of your own? Having an easy-to-run test setup will both help you find the problem, and verify if your solution really fixes it.

Do you need to bring in other libraries and systems to reproduce the problem? If so, consider that the problem may actually be in those other libraries or systems. Again, try a performance profiler here.

Can you identify where the bottleneck is? Is there a particular resource that is being used to its maximum? Is the CPU at 100%? Is there a lot of file IO being done, or a network connection being waited on?

Are there other configuration files the system depends on? Does changing some parameters change the performance? It could be you just need to give the program more memory, or increase the size of a thread pool. Or maybe you're accessing a database somewhere and there's a query that would perform better if you add an appropriate index to a table.

Can you solve the problem by using multiple threads to run multiple calculations simultaneously, rather than one at a time?

Are you using the latest/newest version of the library? And of Java? If not, can you upgrade?

Are there other libraries available that might solve the same problem? Are they any faster? Can you write your own? If the library is open-source, or if it's created by others at your own company, it may be possible to create an improved version of the library.

One thing you should not do: don't get stuck on any one possible explanation and solution for the problem, unless and until you have tried the solution out and verified that it solves the problem. (And even then, check carefully to be sure.) Since there are many possible diagnoses and fixes here, it's easy to waste time on something that you think will fix the problem, but it doesn't. Often, you just have to try different things until something works, and it may be unavoidable to waste some time trying things that don't work. But, try to keep an open mind, alert to the possibility that you've misunderstood the problem. If a "solution" is not working, remember that the problem may not be where you think it is.
 
It's never done THAT before. Explain it to me tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic