Solved

Java Performance singleton

Posted on 2011-03-16
2
855 Views
Last Modified: 2012-05-11
I have a Java multi thread application running in a multi core CPU linux box. Ideally, multi thread would distribute load to different core of CPU. What about if I have singleton, concurrentHashmap, atomicInteger in the application, Would that influence performance? So the load would be decreased since the speed would not that fast as totally concurrently?

0
Comment
Question by:JianJunShen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 2

Accepted Solution

by:
sdern earned 500 total points
ID: 35160946
Are you saying your using a concurrent Hashmap with the singleton design pattern? I dont think you'd need to worry about synchronization when accessing the hashmap because it should be initialized and then would be static. The only synchronization that you would have to worry about is the atomicInteger. The operating system would then handle the work load distribution for the threads.
0
 

Author Closing Comment

by:JianJunShen
ID: 35161920
actually atomicinteger is also fast when there are not too many threads.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question