force Neo4j to be single threaded

55 views
Skip to first unread message

jer

unread,
Jul 11, 2014, 9:49:30 AM7/11/14
to ne...@googlegroups.com
Hi all,

Right now I'm recording Neo4j's start up trace file and try to do some analysis. What I find is that Neo4j is multi-threaded and this make my analysis and play back hard. Is there a way to force Neo4j to be single threaded? Thanks!

Best Wishes,
Jer

jerry yin

unread,
Jul 11, 2014, 11:33:40 AM7/11/14
to ne...@googlegroups.com
Sorry for asking duplicated question, I just find out that I can set org.neo4j.server.webserver.maxthreads=1.

The question now, however, is the way to shut down Neo4j server. I have to start Neo4j server in console mode to record its trace. And from the manual, I must do a C-c to stop the console. But this interrupts my trace-recorder as well. Is there any other way to stop the console such as from the shell/ web UI?

Thanks a lot! 

Michael Hunger

unread,
Jul 11, 2014, 11:47:23 AM7/11/14
to ne...@googlegroups.com
Just use neo4j embedded from java and don't start new threads

Michael

Sent from mobile device
--
You received this message because you are subscribed to the Google Groups "Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

jer

unread,
Jul 20, 2014, 12:54:44 PM7/20/14
to ne...@googlegroups.com
Hi Micheal,

Thanks for your suggestion. I tried with embedded java. But it seems that JVM will automatically launch helper threads. Is there a way to force JVM to be single threaded?

Best,
Jer

Michael Hunger

unread,
Jul 20, 2014, 1:50:42 PM7/20/14
to ne...@googlegroups.com
Why do you need that?

Sent from mobile device
--

jerry yin

unread,
Jul 20, 2014, 2:02:16 PM7/20/14
to ne...@googlegroups.com
Hi Michael,

The reason for this comes from the inherent limitation of my hardware simulator. The simulation requires that only one thread is allowed to run per core. Thus if the JVM launches a number of helper threads, I have to assign same or larger number of cores (maybe 16) before the simulation started. And if the core is less than helper threads that will be launched, a lot of cases Neo4j server script will just get stuck and never finish. The point is that I have no clue of how many threads there will be before successfully running the Neo4j application. This makes my simulation rather hard. Any suggestion on limiting the number of thread will be appreciated! Thank you!

Jer

Michael Hunger

unread,
Jul 20, 2014, 10:39:05 PM7/20/14
to ne...@googlegroups.com
There are a number of ways on how you can control helper threads for the jvm.

You'll have to look at the JVM config for how to turn which off.

You might want to disable remote shell too and UDC.

So you get rid of more thread.

You can test it with jstack <pid> on your machine how many threads are running.

Michael

jer

unread,
Jul 22, 2014, 10:34:14 AM7/22/14
to ne...@googlegroups.com
Hi Michael,

So I tried your suggestions by diableing the remote shell and UDC. But the number of thread that JVM launches does not seem to change (still more than 10 threads). By looking closer at neo4j configurations, I don't seem to find much stuff to disable. Do you mind giving me more suggestions? Thank you!

Also sometimes the Neo4j server script run into deadlock and doesn't finish. The result for me using jstack are usually two threads as follows:

Thread 10033: (state = BLOCKED)
 - java.lang.Object.wait(long) @bci=0 (Interpreted frame)
 - java.lang.ref.ReferenceQueue.remove(long) @bci=44, line=135 (Interpreted frame)
 - java.lang.ref.ReferenceQueue.remove() @bci=2, line=151 (Interpreted frame)
 - java.lang.ref.Finalizer$FinalizerThread.run() @bci=16, line=189 (Interpreted frame)

Thread 10032: (state = BLOCKED)
 - java.lang.Object.wait(long) @bci=0 (Interpreted frame)
 - java.lang.Object.wait() @bci=2, line=503 (Interpreted frame)
 - java.lang.ref.Reference$ReferenceHandler.run() @bci=46, line=133 (Interpreted frame)

Both threads are Blocked and not making any achievement. Is there a way to tell what the two threads are doing or disable them two from beginning?

Best Wishes,
Jer

Michael Hunger

unread,
Jul 23, 2014, 6:09:51 AM7/23/14
to ne...@googlegroups.com
These are JVM threads and I'm not sure if they can be disabled at all. They only run when they have to clean up Objects with finalize methods or weak/soft references.


--
Reply all
Reply to author
Forward
0 new messages