1

Given we have an application that is heavily polluted with concurrency constructs multiple techniques are used (different people worked without clear architecture in mind), multiple questionable locks that are there "just in case", thread safe queues. CPU usage is around 20%.

Now my goal is to optimize it such that it is making better use of caches and generally improve its performance and service time.

I'm considering to pin the parent process to a single core, remove all things that cause membars, replace all thread safe data structures and replace all locks with some UnsafeReentrantLock which would simply use normal reference field but take care of exclusive execution needs...

I expect that we would end up with much more cache friendly application, since we don't have rapid cache flushes all the time (no membars). We would have less overhead since we dont need thread safe data structures, volaties, atomics and replace all sorts of locks with I would assume that service time would improve also, since we no longer synchronize on multiple thread safe queues...

Is there something that I'm overlooking here?

Maybe blocking operations would have to be paid attention to since they would not show up in that 20% usage?

vach
  • 10,571
  • 12
  • 68
  • 106
  • *CPU usage is around 20%.* Is that good or bad? – Scary Wombat Jun 26 '18 at 04:42
  • Assuming that one core is 100%, its overall accumulated usage across multiple cores is less than 20%... hence i assume it could do everything on one core and not have cpu sarvation... – vach Jun 26 '18 at 04:44
  • Memory usage is also an important metric here along with CPU usage. – Sid Jun 26 '18 at 04:46
  • 1
    From that general a description, I can only advise against trying to optimize. It doesn't sound like it'll gain much, but when you get just one thing wrong removing the just in case locks, you're in debugging hell. – daniu Jun 26 '18 at 05:22
  • why would memory usage change to worse? – vach Jun 26 '18 at 06:37
  • forget the specific example, consider it as an approach to running microservices in jvm, why wont someone pin everything to one core, if one core is more than enough... condiering how many problems are solved just by doing that... – vach Jun 26 '18 at 06:39

0 Answers0