user200340
user200340

Reputation: 3371

Database design, real time or batch processing

I am facing two options of how to update the database, and do not know which one is better for my situation. There are three tables in the database, which are used to read/store some user's information, such the url history or some inputs. In real time, the database is accessible by users all the time, so the changes made to the database can be seen immediately by that user. The batch processing hides the "update" from user, database is updated by parsing the log files, and such a process runs every X hours. So user can only see their changes after X hours.

Apart from the advantage/disadvantage of synchronized/asynchronized updates that user can see. What are the other benefits of choosing real-time or batch processing updating methods for database updating?

Thanks

Upvotes: 1

Views: 2801

Answers (2)

Pat B
Pat B

Reputation: 1955

I would suggest you use EDA (Event Driven Architecture) which uses a middleware to "glue" all of this.

http://searchsoa.techtarget.com/definition/event-driven-architecture

One advice : Keep away from batch processes.

Today, everything tends to be more and more real-time. Imagine if you would receive my answer in X hours... would you be satisfied? :)

If you give us more Info, we could also help you more.

I see that your input comes from a log file? Can this be changed? You could also implement the observer pattern.

Upvotes: 1

It all depends on the amount of traffic you expect. If you want to scale your application, asynchronous processing is always recommended. But that does not mean that your users have to wait for X hours. You can have the process run every 5 minutes or even every minute.

This way you will reduce concurrency issues and at the same time users will be able to see their updated history with a little bit of delay.

See best practices for scalability in the book Scalability Rules

Upvotes: 2

Related Questions