简体   繁体   English

从oracle数据库中获取数据时浏览器中的504网关超时

[英]504 gateway timeout in the browser when fetching the data from oracle database

the title of the questions says every thing. 问题的标题说明了一切。 this is happening in the cloud foundry environment. 这是在Cloud Foundry环境中发生的。 the application structure is like this there are two databases one is Mysql and other one is Oracle both are configured and its datasources are created well. 应用程序结构是这样的,有两个数据库,一个是Mysql,另一个是Oracle,两者都已配置,并且其数据源创建良好。

The ultimate goal is to fetch the data present in the oracle database into mysql database using Springboot application(ETL). 最终目标是使用Springboot应用程序(ETL)将oracle数据库中存在的数据提取到mysql数据库中。 It takes approx 30 mins to run the select query in the oracle DB as there are joins applied on tables with huge data around 10000 records will be fetched after the select query execution. 在Oracle DB中运行选择查询大约需要30分钟,因为在执行选择查询后,将对具有大约10000条记录的海量数据的表应用联接。

its working very well when i run the same in the local environment in eclipse IDE. 当我在eclipse IDE中在本地环境中运行相同的程序时,它的效果很好。 but the problem comes up in cloud environment. 但是问题出在云环境中。

When i run the rest link in the browser in cloud env. 当我在云环境的浏览器中运行其余链接时。 It runs for around 10 to 15 mins and throws 504 httpstatus and what i observed is that in the background the data is fetched in the application. 它运行大约10到15分钟,并抛出504 httpstatus,我观察到的是在后台从应用程序中获取数据。 I can see that in the logs which is kept. 我可以在保留的日志中看到这一点。 but in the browser it throws the exception. 但在浏览器中会引发异常。

I would like to show my code if its mine but actually its a company work thats why i cannot show it.. 我想显示我的代码,如果它是我的,但实际上是公司工作,这就是为什么我不能显示它的原因。

could someone please help me out with this 504 error ? 有人可以帮我解决504错误吗?

Based on limited information that you have shared, it looks like you are invoking a REST API to run the ETL job which transfers the data from one database to another which is a time consuming/long running job. 根据您共享的有限信息,您似乎正在调用REST API来运行ETL作业,该作业将数据从一个数据库传输到另一个数据库,这是一项耗时/长时间的工作。 According to me, this is a good candidate for an asynchronous operation instead of a synchronous one. 在我看来,这是异步操作而不是同步操作的不错选择。 With as much details as you have given, I would advise that your REST API should trigger a new thread which takes up the job of running the ETL job in the background, and immediately return success in the response if the thread is successfully triggered. 根据您提供的详细信息,我建议您的REST API应该触发一个新线程,该线程负责在后台运行ETL作业,如果成功触发了该线程,则立即在响应中返回成功。 You can then have another operation on your UI that would show the status of the ETL job which would have to be maintained somewhere in the database and picked up from there using a service and shown on the UI. 然后,您可以在UI上执行另一项操作,以显示ETL作业的状态,该状态必须维护在数据库中的某个位置,然后使用服务从那里进行拾取并显示在UI上。

NOTE: Gateway timeout is inevitable for such long running operations if done synchronously, unless you increase the timeout of the respective service, which I wouldn't suggest doing. 注意:如果同步执行,则对于如此长时间运行的操作,网关超时是不可避免的,除非您增加了相应服务的超时,我不建议这样做。

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

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