Solved

Java Performance singleton

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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Tomcat: Unable to run tomcat service. 2 29
JAVA API design with micro service cloud in mind 1 77
Java: anonymous class 4 38
passing enum to a method 4 35
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
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:

756 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