如何才能最好地将我的应用程序与不可靠的数据库隔离开来?

时间:2022-03-14 20:13:45

I have a Java SOAP data service which sits on top of a Sybase database which, for reasons out of my control, has unreliable performance. The database is part of a vendor package which has been modified by an internal team and most of the issues are caused by slow response times at certain times of the day.

我有一个Java SOAP数据服务,它位于Sybase数据库之上,由于我无法控制的原因,它具有不可靠的性能。该数据库是供应商软件包的一部分,该软件包已由内部团队修改,大多数问题是由一天中某些时间的响应时间较慢引起的。

The SOAP service provides data to a calculation grid and when I request data, I need the response time to be both fast and consistent. The service provides basic CRUD functionality, but the ratio of reads to writes is approximately 100:1.

SOAP服务向计算网格提供数据,当我请求数据时,我需要响应时间快速且一致。该服务提供基本的CRUD功能,但读写比率约为100:1。

What is the best strategy to isolate myself from the database's unreliable performance and ensure that the SOAP service is fast and reliable?

将自己与数据库的不可靠性能隔离开来并确保SOAP服务快速可靠的最佳策略是什么?

6 个解决方案

#1


3  

I have seen this issue a few times, normally with a vendor database.

我已经看过几次这个问题,通常是供应商数据库。

If this is on Windows, you could create a Windows service as an intermediary between the SOAP service and the database. Then put a message queue (either MSMQ or a JMS implementation such as MQ Series) between the SOAP service and Windows service for asynchronous communications. In this way the database performance issues will no longer affect the SOAP service. This solution does, however, come at the cost of increased complexity.

如果这是在Windows上,您可以创建Windows服务作为SOAP服务和数据库之间的中介。然后在SOAP服务和Windows服务之间放置一个消息队列(MSMQ或JMS实现,如MQ Series),以进行异步通信。这样,数据库性能问题将不再影响SOAP服务。然而,该解决方案的确以增加复杂性为代价。

Note that a .NET web service can be called by, and respond asynchronously to, its clients. I'm not sure if that's possible with a Java SOAP service.

请注意,.NET Web服务可以由其客户端调用并异步响应。我不确定Java SOAP服务是否可行。

If this is on some flavour of Unix, I assume it has similar functionality to a Windows service - maybe a daemon.

如果这是在Unix的某些风格,我认为它具有与Windows服务类似的功能 - 可能是一个守护进程。

#2


1  

Why not use a thread? That way, the application could gently wait even if the database is slow.

为什么不使用线程?这样,即使数据库速度很慢,应用程序也可以轻轻等待。

#3


1  

RoadWarrior's response is right on. Requests to do any operation get put in a queue. The user comes in once to make the request, and once to pick up the request. This is in fact what is happening on sites like Expedia where it is talking to an unreliable service (the backend). The user's browser is pinging the server until the red light turns green.

RoadWarrior的回应是正确的。执行任何操作的请求都会被放入队列中。用户进入一次以发出请求,并且一次接收请求。这实际上是在Expedia这样的网站上发生的事情,它与不可靠的服务(后端)进行通信。用户的浏览器正在ping服务器,直到红灯变为绿色。

#4


0  

How about caching the responses from the web service (either on the client invoking the WS request, or by setting up a proxy web service in between)?

如何缓存来自Web服务的响应(在调用WS请求的客户端上,或通过在其间设置代理Web服务)?

#5


0  

You could cache the results from the DB if the DB Is not too big.

如果数据库不是太大,您可以缓存数据库中的结果。

#6


0  

Get the other internal team to tune that database, so everyone using the app benefits. I do love me some indexes!

让其他内部团队调整该数据库,这样每个使用该应用程序的人都会受益。我爱我一些索引!

#1


3  

I have seen this issue a few times, normally with a vendor database.

我已经看过几次这个问题,通常是供应商数据库。

If this is on Windows, you could create a Windows service as an intermediary between the SOAP service and the database. Then put a message queue (either MSMQ or a JMS implementation such as MQ Series) between the SOAP service and Windows service for asynchronous communications. In this way the database performance issues will no longer affect the SOAP service. This solution does, however, come at the cost of increased complexity.

如果这是在Windows上,您可以创建Windows服务作为SOAP服务和数据库之间的中介。然后在SOAP服务和Windows服务之间放置一个消息队列(MSMQ或JMS实现,如MQ Series),以进行异步通信。这样,数据库性能问题将不再影响SOAP服务。然而,该解决方案的确以增加复杂性为代价。

Note that a .NET web service can be called by, and respond asynchronously to, its clients. I'm not sure if that's possible with a Java SOAP service.

请注意,.NET Web服务可以由其客户端调用并异步响应。我不确定Java SOAP服务是否可行。

If this is on some flavour of Unix, I assume it has similar functionality to a Windows service - maybe a daemon.

如果这是在Unix的某些风格,我认为它具有与Windows服务类似的功能 - 可能是一个守护进程。

#2


1  

Why not use a thread? That way, the application could gently wait even if the database is slow.

为什么不使用线程?这样,即使数据库速度很慢,应用程序也可以轻轻等待。

#3


1  

RoadWarrior's response is right on. Requests to do any operation get put in a queue. The user comes in once to make the request, and once to pick up the request. This is in fact what is happening on sites like Expedia where it is talking to an unreliable service (the backend). The user's browser is pinging the server until the red light turns green.

RoadWarrior的回应是正确的。执行任何操作的请求都会被放入队列中。用户进入一次以发出请求,并且一次接收请求。这实际上是在Expedia这样的网站上发生的事情,它与不可靠的服务(后端)进行通信。用户的浏览器正在ping服务器,直到红灯变为绿色。

#4


0  

How about caching the responses from the web service (either on the client invoking the WS request, or by setting up a proxy web service in between)?

如何缓存来自Web服务的响应(在调用WS请求的客户端上,或通过在其间设置代理Web服务)?

#5


0  

You could cache the results from the DB if the DB Is not too big.

如果数据库不是太大,您可以缓存数据库中的结果。

#6


0  

Get the other internal team to tune that database, so everyone using the app benefits. I do love me some indexes!

让其他内部团队调整该数据库,这样每个使用该应用程序的人都会受益。我爱我一些索引!