Solved

Java Performance singleton

Posted on 2011-03-16
2
848 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
best (free) software to access postgres db (java) 1 32
Unable to start eclipse ? 17 132
table example 4 23
configure dependency in POM for new database 3 16
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

910 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now