Re: [Neo4j] Neo4j connection timeout between servers

2018-11-28 Thread 'Michael Hunger' via Neo4j
Could you please create this issue in spring data neo4j jira? Thx

Von meinem iPhone gesendet

> Am 28.11.2018 um 08:33 schrieb Siva Punnaivanam :
> 
> Hi Team, 
> 
> We have installed neo4j (neo4j-community-3.4.7-unix.tar) on a Server 1 and 
> our spring boot application deployed on server 2 is using that neo4j database.
> We often getting connection timeout issue in our application and immediately 
> on next try it is working fine. 
> Connection time out is not bcoz of long inactive time. 
> Though we are using application regressively, we are getting connection 
> timeout suddenly in between and on immediate next try it is working fine.
> 
> This is the neo4j property details given in our spring boot application 
> running on server 2. 
> 
> spring.data.neo4j.uri=bolt://X.X.X.X:17687
> spring.data.neo4j.username=neo4j
> spring.data.neo4j.password=xx
> 
> And below is the configuration file we used in our applicaiton to create the 
> connection.
> 
> @EnableNeo4jRepositories(basePackages = "com.metadata.dao", sessionFactoryRef 
> = "userSessionFactory", transactionManagerRef = "userTransactionManager")
> @Configuration
> @EnableTransactionManagement
> public class Neo4jConfiguration {
> 
>   @Value("${spring.data.neo4j.uri}")
>   private String url;
> 
>   @Value("${spring.data.neo4j.username}")
>   private String userName;
> 
>   @Value("${spring.data.neo4j.password}")
>   private String password;
> 
>   @Bean(name = "userSessionFactory")
>   @Primary
>   public SessionFactory bUserSessionFactory() {
>   return new SessionFactory(bUserconfiguration(), 
> "com.metadata.dao.entity");
>   }
> 
>   @Bean
>   public org.neo4j.ogm.config.Configuration bUserconfiguration() {
>   org.neo4j.ogm.config.Configuration configuration = new 
> org.neo4j.ogm.config.Configuration.Builder().uri(url)// "bolt://localhost"
>   .credentials(userName, password)// "user", 
> "secret")
>   .build();
>   return configuration;
>   }
> 
>   @Bean
>   public Neo4jTransactionManager bUserTransactionManager() {
>   return new Neo4jTransactionManager(bUserSessionFactory());
>   }
> 
> }
> 
> And attached is the neo4j connection time out logs we got in our application 
> logs. 
> 
> Please help me to resolve the issue. Kindly let me know if you need any 
> additional information.
> 
> 
> -- 
> 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+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
> 

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Neo4j] Atomicity of RecordStorageEngine in Neo4j

2018-11-28 Thread 'Chris Vest' via Neo4j
> Speaking of read operation, I will consider "Node.getProperties(String...
names)" as a single read operation

It's a read operation per property name. You can read them all atomically
if you grab a read lock on the node with "Transaction.acquireReadLock( node
)".

On Tue, Nov 27, 2018 at 5:18 AM sel-fish finch 
wrote:

> Thanks for your answer, Chris.
>
> Speaking of read operation, I will consider "Node.getProperties(String...
> names)" as a single read operation.
> So if I try to modify the value of two properties in a write transaction,
> i expect the method 'getProperties' return both the old values or both the
> new values.
> Is that expectation right ?
>
>
> 在 2018年11月26日星期一 UTC+8下午6:33:04,Chris Vest写道:
>>
>> Neo4j is Read Committed, which gives us a lot of freedoms that we can
>> exploit to optimise performance.
>> Being Read Committed means that transactions can observe newly committed
>> data at any time.
>> The most common way to think of this, is to imagine the read operations
>> spread out on a time line, with a write set from newly committed write
>> transactions intersecting at particular instants.
>> This mental model assumes that writes are applied atomically, and reads
>> are not. It is how this is most commonly explained in literature.
>> However, you can also think of this as the reads intersecting an instant
>> on a time line of write operations. These two models are isomorphic.
>> In your example, it means that we can update the properties one at a
>> time, and if you observe them being updated out of lock-step, we can tell
>> you the write happened atomically in between your two reads.
>> There is more going on to make this work well in practice; careful
>> ordering of operations on the write side, and compensating actions on the
>> read side, and also (very fast) page-level read/write latches to ensure
>> record-level atomicity.
>> This means that we can get away with very few read locks, while still
>> being Read Committed. And in the vast majority of cases, Read Committed
>> works out well for graphs.
>> Neo4j uses Pessimistic Concurrency Control and 2 Phase Locking, so in the
>> few cases where Read Committed is not enough, it is very easy to locally
>> strengthen your isolation level by just taking more locks.
>>
>> On Mon, Nov 26, 2018 at 4:54 AM sel-fish finch 
>> wrote:
>>
>>> Asked this question in SO
>>> ,
>>> as i'm still struggling to get the answer through the code,  I prefer to
>>> try my luck here :)
>>>
>>>
>>> Base on the source code of neo4j 3.2.3
>>> ,
>>> TransactionRepresentationCommitProcess.commit will do the work to
>>> commit transaction changes maintained in TxState.
>>>
>>> It contains two parts: append to transaction log; apply to store which
>>> is RecordStorageEngine.
>>>
>>> That's a typical practice to commit a transaction. As in other storage
>>> engine, we use mvcc or read lock to make sure the changes of transaction
>>> happen atomically.
>>>
>>> My question is:
>>> *How RecordStorageEngine ensure the atomicity of transaction?*
>>>
>>> To be precise, if one transaction modifies the values of two properties.
>>> Will these two changes happen atomically?
>>>
>>> --
>>> 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.
>>>
>> --
> 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+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Neo4j] Neo4j connection timeout between servers

2018-11-28 Thread Siva Punnaivanam
Hi Team, 

We have installed neo4j (neo4j-community-3.4.7-unix.tar) on a Server 1 and 
our spring boot application deployed on server 2 is using that neo4j 
database.
We often getting connection timeout issue in our application and 
immediately on next try it is working fine. 
Connection time out is not bcoz of long inactive time. 
Though we are using application regressively, we are getting connection 
timeout suddenly in between and on immediate next try it is working fine.

This is the neo4j property details given in our spring boot application 
running on server 2. 

spring.data.neo4j.uri=bolt://X.X.X.X:17687
spring.data.neo4j.username=neo4j
spring.data.neo4j.password=xx

And below is the configuration file we used in our applicaiton to create 
the connection.

@EnableNeo4jRepositories(basePackages = "com.metadata.dao", 
sessionFactoryRef = "userSessionFactory", transactionManagerRef = 
"userTransactionManager")
@Configuration
@EnableTransactionManagement
public class Neo4jConfiguration {

@Value("${spring.data.neo4j.uri}")
private String url;

@Value("${spring.data.neo4j.username}")
private String userName;

@Value("${spring.data.neo4j.password}")
private String password;

@Bean(name = "userSessionFactory")
@Primary
public SessionFactory bUserSessionFactory() {
return new SessionFactory(bUserconfiguration(), "com.metadata.dao.entity");
}

@Bean
public org.neo4j.ogm.config.Configuration bUserconfiguration() {
org.neo4j.ogm.config.Configuration configuration = new 
org.neo4j.ogm.config.Configuration.Builder().uri(url)// "bolt://localhost"
.credentials(userName, password)// "user", "secret")
.build();
return configuration;
}

@Bean
public Neo4jTransactionManager bUserTransactionManager() {
return new Neo4jTransactionManager(bUserSessionFactory());
}

}

And attached is the neo4j connection time out logs we got in our 
application logs. 

Please help me to resolve the issue. Kindly let me know if you need any 
additional information.


-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
"28-Nov-2018 06:53:57.195 SEVERE [Neo4jDriverIO-4-3] 
org.neo4j.driver.internal.logging.JULogger.error [0xce2280f4] Fatal error 
occurred in the pipeline
 java.io.IOException: Connection timed out
at sun.nio.ch.FileDispatcherImpl.read0(Native Method)
at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39)
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
at sun.nio.ch.IOUtil.read(IOUtil.java:192)
at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380)
at 
org.neo4j.driver.internal.shaded.io.netty.buffer.PooledUnsafeDirectByteBuf.setBytes(PooledUnsafeDirectByteBuf.java:288)
at 
org.neo4j.driver.internal.shaded.io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1106)
at 
org.neo4j.driver.internal.shaded.io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:343)
at 
org.neo4j.driver.internal.shaded.io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:123)
at 
org.neo4j.driver.internal.shaded.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:645)
at 
org.neo4j.driver.internal.shaded.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:580)
at 
org.neo4j.driver.internal.shaded.io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:497)
at 
org.neo4j.driver.internal.shaded.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:459)
at 
org.neo4j.driver.internal.shaded.io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858)
at 
org.neo4j.driver.internal.shaded.io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:138)
at java.lang.Thread.run(Thread.java:748)

"2018-11-28 06:53:57 [Neo4jDriverIO-4-3] ERROR ChannelErrorHandler - 
[0xce2280f4] Fatal error occurred in the pipeline
"java.io.IOException: Connection timed out
at sun.nio.ch.FileDispatcherImpl.read0(Native Method)
at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39)
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
at sun.nio.ch.IOUtil.read(IOUtil.java:192)
at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380)
at 
org.neo4j.driver.internal.shaded.io.netty.buffer.PooledUnsafeDirectByteBuf.setBytes(PooledUnsafeDirectByteBuf.java:288)
at 
org.neo4j.driver.internal.shaded.io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1106)
at 
org.neo4j.driver.internal.shaded.io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:343)
at