Hi. I've recently started using cyhper and I really like it and would like
to introduce it to our (upcoming) application. I have a few question in
this regard.
1. Does it make sense to replace all traversals done with the API with
cyhper queries? This is much more readable and much shorter and the
expressiveness can not really be compared - cypher is a clear winner, so I
would be tempted to use it everywhere. Are there gotchas?
2. As far as I know, although I cannot find it in the API,
GraphDatabaseService instances are thread safe (is this correct?). How
about the ExecutionEngine in java.compat? Can I just create a single
instance of it and share between threads, or should I create multiple
instances?
3. How does caching of queries look like? Do I need to do anything special,
or does the engine cache things itself? If I have multiple threads and each
has its own ExecutionEngine (if this is required, see above), this would
mean I have a few caches. Can such caches be shared in some way (again,
only if multiple engines are needed)?
> Hi. I've recently started using cyhper and I really like it and would like to introduce it to our (upcoming) application. I have a few question in this regard.
Thanks a lot.
> 1. Does it make sense to replace all traversals done with the API with cyhper queries? This is much more readable and much shorter and the expressiveness can not really be compared - cypher is a clear winner, so I would be tempted to use it everywhere. Are there gotchas?
It depends, by 1.8 cypher has not been performance optimized to be en par with traversals, for 1.9 we're working on that. Best is to compare the performance and use cypher wherever the difference is not critical.
> 2. As far as I know, although I cannot find it in the API, GraphDatabaseService instances are thread safe (is this correct?). How about the ExecutionEngine in java.compat? Can I just create a single instance of it and share between threads, or should I create multiple instances?
Yes it is thread-safe.
> 3. How does caching of queries look like? Do I need to do anything special, or does the engine cache things itself? If I have multiple threads and each has its own ExecutionEngine (if this is required, see above), this would mean I have a few caches. Can such caches be shared in some way (again, only if multiple engines are needed)?
Queries are cached by their query string in the execution-engine itself. So please use parameters to allow the engine to reuse already parsed queries. No need for separate execution-engines.
Please report back on your progress and if you ran into any issue.
Hi. At this point, I am not concerned at all about the performance of the application - we need to have something quickly and working, tuning will be done later, if at all necessary. If this means replacing certain cypher queries with traversal, so be it - but for now, functionality and time to market is more important, and here cypher cannot be beaten, I think ;d How much a performance penalty would you expect, if any, based on your experience? Twice as slow, 10x as slow? I'm asking as what we are trying to build is a webapp, and if the penalty is somewhere around 2x, it doesn't really matter, at least I think so now. When there is nothing more to do (ha!) and we are bored, we might fine tune it even when not necessary ;d
Thanks for the info about the engine - it is very nice that I don't have to take care about these things myself.
On Thursday, October 11, 2012 9:30:01 AM UTC+2, Michael Hunger wrote:
> Hi,
> Am 11.10.2012 um 09:25 schrieb Wujek Srujek:
> > Hi. I've recently started using cyhper and I really like it and would > like to introduce it to our (upcoming) application. I have a few question > in this regard. > Thanks a lot. > > 1. Does it make sense to replace all traversals done with the API with > cyhper queries? This is much more readable and much shorter and the > expressiveness can not really be compared - cypher is a clear winner, so I > would be tempted to use it everywhere. Are there gotchas? > It depends, by 1.8 cypher has not been performance optimized to be en par > with traversals, for 1.9 we're working on that. Best is to compare the > performance and use cypher wherever the difference is not critical.
> > 2. As far as I know, although I cannot find it in the API, > GraphDatabaseService instances are thread safe (is this correct?). How > about the ExecutionEngine in java.compat? Can I just create a single > instance of it and share between threads, or should I create multiple > instances? > Yes it is thread-safe. > > 3. How does caching of queries look like? Do I need to do anything > special, or does the engine cache things itself? If I have multiple threads > and each has its own ExecutionEngine (if this is required, see above), this > would mean I have a few caches. Can such caches be shared in some way > (again, only if multiple engines are needed)?
> Queries are cached by their query string in the execution-engine itself. > So please use parameters to allow the engine to reuse already parsed > queries. No need for separate execution-engines.
> Please report back on your progress and if you ran into any issue.