What would be the impact of Connecting two applica

2019-06-07 05:47发布

There are 2 different applications running on the same jboss server. I want to connect these 2 applications with the same mysql database through the same data source.

what kind of impact can be occur in running these 2 application -

I am supposing that these issues could be happen . - Table Locking issues, Slow performance, connectivity issue, ACID properties lost issue.

Are there any drawbacks with this approach?

4条回答
别忘想泡老子
2楼-- · 2019-06-07 06:02

There are no drawbacks, as long as there are enough connections for both apps and your transactions are well written its normal to share the same datasource

查看更多
Viruses.
3楼-- · 2019-06-07 06:10

Perhaps you should consider if there are any advantages?

In my opinion there is have to be compelling reasons to not create separate datasources for separate applications - I sense that this is not the case for you.

In any case, some of the drawbacks you mention may happen when you share a connection pool between applications or when you don't since they are properties of the database not the connections.

Edit: Summarizing the good discussion with Jan Dvorak below, here are some arguments for using one (or more) datasources per application:

  • It enables one to discard eg. stale or appserver-culled connections (-threads) from one application without affecting others
  • Having multiple DS'es per application enables one to reset admin connections without affecting production connections.

Cheers,

查看更多
forever°为你锁心
4楼-- · 2019-06-07 06:15

Nothing of this can happen (Table Locking issues, Slow performance, connectivity issue, ACID properties lost issue).

The database cannot really distinguish if two connections come from the same application.

Of course, two applications still means twice as many requests, so performance may be affected. ACIDity is not affected and you are unlikely to run out of TCP ports either.

The performance of two apps accessing the same database is the same as the performance of one app twice as popular.

查看更多
劫难
5楼-- · 2019-06-07 06:17

The main issue would be with pooling. As more applications use the datasource, more connections are open so the default pool may not be enough.

Apart from that, all the other issues are related to the DB engine and your DB design than to the datasource. A DB engine won't stop being ACID compliant no matter how it is accessed, won't be slower than if the accesses were from different datasources, and so on...

查看更多
登录 后发表回答