Errors with JDBC Event store

Hi,
In our application I am using Distributed command bus with JDBCEventStore. In my application I need to handle multiple concurrent requests of same type, but dealing with new aggregate.
I found too many exceptions in logs when multiple requests comes, which impact the functionality of the application

  1. We are getting java.sql.SQLException: ORA-01000: maximum open cursors exceeded, during Event store and Daga Entry.
  2. Getting org.axonframework.repository.ConcurrencyException: Concurrent modification detected for Aggregate identifier, when two events tries to modify aggregate at the same time.

Is there any configuration suggestion, which can help us to avoid this concurrency exception. Reason being as per requirement we may get multiple events to modify the aggregate.
On our DB setup we have cusor set to 1000, still we see we are getting this exception and which results in insertion of jobs in quartz table and which is impacting the functionality.

Also one issue noticed that insertion to DomainEventEntry, Quartz table, SagaEntry and AssociationValueEntry table takes long time. This is not the case when application is started, this is noticed that 20-30 min after application startup, record insertion to these tables takes time. On DB side we found this is because of row contention and elapsed time. This is impacting the performance of the application.

Do you have any recommendations?

Thanks,
Vijaya

Hi,

which command bus do you use? Normally, each thread will use a cursor on the Event Store to read events. If you allow more threads to the command bus than you allow cursors, you might end up with this situation. Using a command bus like the DisruptorCommandBus allows you to minimize the number of threads accessing the event store.

Concurrency exception happen when the event store attempts to append an event with a sequence number that already exists for any given aggregate. This happens when 2 nodes simultaneously access the same aggregate. Make sure commands to the same aggregate are routed to the same node. Alternatively, retry the command when it fails with a ConcurrencyException.

Regarding the insertions taking longer, another discussion thread just started about that. I am not aware of any issues, so I don’t know what could be causing the slowing down. In your database, make sure that you’re locking individual rows, not entire pages. That might help improve performance on the event store. Alternatively, reduce the number of connections that modify the Event Store concurrently, for example by using the DisruptorCommandBus.

Cheers,

Allard

I am using Distributed command bus, with two instances of application. In this two events for same aggregate should go to same instance.
As per requirement I need to use DistributedCommandBus only.

Please suggest.

Thanks,

If you’re only using the DistributedCommandBus, and are not specifying any “localSegment”, you’re using the SimpleEventBus locally.

The open cursors problem might be caused by connections not being closed correctly. How did you configure the ConnectionProvider (or DataSource) on the EventStore?

Hi Allard,
We are specifying localSegment with DistributedCommandBus. We are configuring datasource on EventStore.

Thanks,