How to optimize the number of database connections?

We have a Java (Spring) web application with a Tomcat servlet container. We have a bit of a blog. But a blog needs to dynamically upload its posts using Ajax. The ajax script client checks for new messages every second . That is, Ajax must each time request a server for new messages, and it will be very difficult for the database.

But what if we connect in hundreds of thousands at the same time? I think that we should receive all messages with cron every time and after that save them somewhere. But where? The main idea is to unload the database. Any ideas on architecture? Thanks in advance!

+3
source share
3 answers

There is another polling architecture that may be more optimal, depending on the case:

Long survey

- . , . , , , , . ( -), . , , . Web/AJAX .

: Push Server

.

+3

. , , , -, .

, .

0

Tomcat, WebSphere .

, ?

In addition, you may also want to “partition” the database depending on the region, etc. Thus, there is no single large load across the entire database, but it can be divided and even load balanced.

There are also NoSQL databases to explore. Maybe something to consider. Just ideas to help.

0
source

Source: https://habr.com/ru/post/1769539/


All Articles