|
Answer» • Avoid synchronization where possible
• Code a multi-thread for multi-processor machine.
• Synchronizing on method rather than code blocks is SLIGHTLY FASTER.
• Polling is only acceptable when waiting for outside events and should be performed in a "side" thread. Use wait/NOTIFY instead.
• Prioritize threads. Use notify instead of notifyAll. Use synchronization sparingly.
• KEEP synchronized methods out of loops if you possibly can.
• Maximize thread lifetimes and minimize thread creation/destruction cycles.
• Use Thread pools where these improve performance.
• Use Thread.sleep() instead of a for loop for measured delays.
• Use a separate timer thread to timeout socket operations.
• Use more server threads if multiple connections have HIGH latency. • Avoid synchronization where possible
• Code a multi-thread for multi-processor machine.
• Synchronizing on method rather than code blocks is slightly faster.
• Polling is only acceptable when waiting for outside events and should be performed in a "side" thread. Use wait/notify instead.
• Prioritize threads. Use notify instead of notifyAll. Use synchronization sparingly.
• Keep synchronized methods out of loops if you possibly can.
• Maximize thread lifetimes and minimize thread creation/destruction cycles.
• Use Thread pools where these improve performance.
• Use Thread.sleep() instead of a for loop for measured delays.
• Use a separate timer thread to timeout socket operations.
• Use more server threads if multiple connections have high latency.
|