Neo4j performance using PHP API

271 views
Skip to first unread message

Тарасов Константин

unread,
Oct 1, 2012, 5:08:20 AM10/1/12
to ne...@googlegroups.com
i have database with ~1000 nodes and ~1000 relations 
(windows, neo4jphp, default server configuration)

Next query takes 300ms:

START root=node(1)
MATCH root
-[r*..3]->tag
return collect(tag) as tags, collect(r) as rels

I think it is too slow. Maybe something is wrong? 

PS Also i've some magic :) When i place datebase to (system disk) SSD, execution time increase to 1000ms

Mattias Persson

unread,
Oct 1, 2012, 6:45:48 AM10/1/12
to ne...@googlegroups.com


2012/10/1 Тарасов Константин <terr...@gmail.com>

Would that be for the first run? Because caches aren't warmed up by then. Run your query at least two times within the same db instance.

--
 
 



--
Mattias Persson, [mat...@neotechnology.com]
Hacker, Neo Technology
www.neotechnology.com

Michael Hunger

unread,
Oct 1, 2012, 6:38:17 AM10/1/12
to ne...@googlegroups.com
Ist this the first execution?
Try to measure the second and later

Also you don't need to collect in your usecase as you don't have grouping values

Then you can also use order by

Sent from mobile device
--
 
 

Тарасов Константин

unread,
Oct 1, 2012, 6:50:35 AM10/1/12
to ne...@googlegroups.com
Would that be for the first run? Because caches aren't warmed up by then. Run your query at least two times within the same db instance.
at warming up it takes about 1000ms
and at second query - 300ms
(structure is tree with depth = 3)

Тарасов Константин

unread,
Oct 1, 2012, 7:04:52 AM10/1/12
to ne...@googlegroups.com

Ist this the first execution?
Try to measure the second and later
1st: 1000ms
2nd: 300ms
 
Also you don't need to collect in your usecase as you don't have grouping values
Then you can also use order by

i use collect() to prepare data for Javascript
you won't believe me, but collect(*) works faster! (300ms vs 800ms)

Josh Adell

unread,
Oct 1, 2012, 12:30:49 PM10/1/12
to ne...@googlegroups.com
Have you determined how much time is spent on the server vs. in your client code? What is the execution time if you execute the query in webadmin or the neo4j shell?

-- Josh

terrasoff

unread,
Oct 1, 2012, 4:14:30 PM10/1/12
to ne...@googlegroups.com
On Monday, October 1, 2012 8:30:49 PM UTC+4, Josh Adell wrote:
Have you determined how much time is spent on the server vs. in your client code? What is the execution time if you execute the query in webadmin or the neo4j shell?

hmm... shell time is ~20ms (after warm up)

php code is too simple to make mistake (i've measured execution time of this code)

    public function getTags() {
        $queryTemplate
=
           
'START root=node(1)
             MATCH root-[r*..3'
]->tag
             RETURN collect
(tag) as nodes, collect(r) as rels
           
';


        $query = new NJ\Cypher\Query($this->getClient(), $queryTemplate);
        return $query->getResultSet($query);
    }

Seems, problems with PHP REST API

Josh Adell

unread,
Oct 1, 2012, 11:23:19 PM10/1/12
to ne...@googlegroups.com
How many nodes and relationships are returned by that query?

-- Josh
Message has been deleted

terrasoff

unread,
Oct 2, 2012, 3:28:55 AM10/2/12
to ne...@googlegroups.com

How many nodes and relationships are returned by that query?
first post:
~1000 nodes/ ~1000 relationships 
structure is tree

Peter Neubauer

unread,
Oct 3, 2012, 9:06:34 AM10/3/12
to ne...@googlegroups.com
So,
could you even check the timing with CURL and the treaming headers
set, so we know if it is the server or the client taking the time?

Cheers,

/peter neubauer

G: neubauer.peter
S: peter.neubauer
P: +46 704 106975
L: http://www.linkedin.com/in/neubauer
T: @peterneubauer

Wanna learn something new? Come to http://graphconnect.com


On Tue, Oct 2, 2012 at 9:26 AM, terrasoff <terr...@gmail.com> wrote:
> first post: ~1000 nodes/ ~1000 relationships
> structure is tree
>
> --
>
>

Gil Hildebrand

unread,
Oct 16, 2012, 8:24:25 PM10/16/12
to ne...@googlegroups.com
Any update on this? I am also using PHP API. Just wondering if you found the problem.

Peter Neubauer

unread,
Oct 17, 2012, 5:46:38 AM10/17/12
to ne...@googlegroups.com
Terasoff,
did you get any more timings on your case?

Cheers,

/peter neubauer

G: neubauer.peter
S: peter.neubauer
P: +46 704 106975
L: http://www.linkedin.com/in/neubauer
T: @peterneubauer

Neo4j 1.8 GA - http://www.dzone.com/links/neo4j_18_release_fluent_graph_literacy.html
> --
>
>

Nadia Berloffa

unread,
Nov 7, 2013, 9:56:43 AM11/7/13
to ne...@googlegroups.com
Hi!!
I've got the same problem. I'm using Neo4jphp. My query is:
MATCH n:concetto WHERE n.sing='alberi'
            OR n.plur='alberi' RETURN n;

If I execute it on webadmin it takes 448 ms, but with getResultSet() on Neo4jphp it takes 6 seconds.
How is it possible? How can I do?

Thanks
Nadia

Michael Hunger

unread,
Nov 7, 2013, 8:17:37 PM11/7/13
to ne...@googlegroups.com, Josh Adell
do you have an index on either of these properties? If you do, can you try to use:

MATCH n:concetto WHERE n.sing='alberi'  RETURN n
UNION
MATCH n:concetto WHERE n.plur='alberi' RETURN n


--
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/groups/opt_out.

Sotiris Tsartsaris

unread,
Nov 8, 2013, 4:03:08 PM11/8/13
to ne...@googlegroups.com
I had the same problem. Solved after increasing the java heap memory size and the memory php uses for script execution.

Waseem Ahmad

unread,
May 13, 2014, 8:14:04 AM5/13/14
to ne...@googlegroups.com
I have same problem ,my simple cypher query takes so much long time , can you please tell me how you increased the java heap memory size?

Michael Hunger

unread,
Jun 10, 2014, 11:14:48 AM6/10/14
to ne...@googlegroups.com
Please share your data model data sizes, config (messages.log) and cypher queries otherwise we can't help you.

--
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.

Reply all
Reply to author
Forward
0 new messages