简体   繁体   English

云到本地 Oracle 数据库连接缓慢

[英]Slowness in cloud to onpremise Oracle database connection

I have some on-premise based frontend java servlet server, on-premise Java backend app server and one on-premise oracle database server.我有一些基于内部部署的前端 java servlet 服务器、内部部署 Java 后端应用服务器和一个内部部署 oracle 数据库服务器。 My Oracle client version is 12.1.0.我的 Oracle 客户端版本是 12.1.0。 Java version is openjdk "1.8.0_222". Java版本是openjdk“1.8.0_222”。 And using tomcat v7.0.55 for frontend servlets.并将 tomcat v7.0.55 用于前端 servlets。 The Architecture is like the backend server communicate with Oracle DB to process SQL queries.该架构就像后端服务器与 Oracle DB 通信以处理 SQL 查询。

Now I moved all my servers to AWS cloud docker based containers except Oracle DB.现在,我将所有服务器移至基于 AWS 云 docker 的容器,但 Oracle DB 除外。 And my Java backend server is running on AWS docker is connecting to Oracle DB running in on-premise Datacenter.我的 Java 后端服务器正在 AWS 上运行 docker 正在连接到 Oracle DB 在本地数据中心中运行。

Now I am facing an issue where the AWS based application having latency when it connects to on-premise database and the latency keeps increasing as the number of requests grows and eventually the application gets gateway timeout if the requests are keep on increasing.现在我面临一个问题,即基于 AWS 的应用程序在连接到本地数据库时会出现延迟,并且随着请求数量的增加,延迟会不断增加,如果请求不断增加,最终应用程序会出现网关超时。 But strangely it will not happen if I connect my AWS tomcat frontend servers to on-premise java backend servers which talks to on-premise Oracle DB.但奇怪的是,如果我将我的 AWS tomcat 前端服务器连接到与本地 Oracle DB 对话的本地 java 后端服务器,则不会发生这种情况。 it only happens when the AWS Java backend servers talks to on-premise Oracle DB.只有当 AWS Java 后端服务器与本地 Oracle 数据库通信时才会发生这种情况。 I am not sure why this is happening.我不确定为什么会这样。 Any ideas will be highly appreciated.任何想法都将受到高度赞赏。

The issue is related to the DAO / ORM framework we using.该问题与我们使用的 DAO / ORM 框架有关。 If you use something like Hibernate, Spring it will work in a way where SQL calls are not optimized with join statements.如果您使用 Hibernate、Spring 之类的东西,它将以 SQL 调用未使用连接语句优化的方式工作。 So to fetch a 1000 objects there will be 1000+ SQL calls.因此,要获取 1000 个对象,将有 1000+ SQL 调用。 So if there is a single digit millisecond latency in the network to Database it will boot to 1000 times delay time.因此,如果网络中到数据库有一个位数毫秒的延迟,它将启动到 1000 倍延迟时间。 So the solution was to keep Database as close as possible with the application.所以解决方案是让数据库尽可能靠近应用程序。

Is there a way we could configure the same in docker container or hibernate configuration @Matt有没有办法我们可以在 docker 容器或 hibernate 配置@Matt 中配置相同的

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM