2017-08-16 68 views
1

我已经在Google App Engine Flexible中部署了一个简单的Spring引导应用程序。该应用程序。有两个API,一个用于将用户数据添加到数据库(xxx.appspot.com/add),另一个用于从数据库(xxx.appspot.com/all)获取所有用户数据。Google App Engine中的502服务器错误使用JMeter进行负载测试时灵活

我想知道GAE如何扩展负载,因此使用JMeter创建一个负载为100秒的用户并发性,并在10秒内提升,并在半秒钟的时间内永远调用这两个API。虽然它在一段时间内运行良好(只有一个实例),但在“java.net.SocketException”或“服务器响应状态为502”30秒钟后,它开始失败。

此错误后,当我尝试从浏览器访问相同的API,它显示,

Error: Server Error

The server encountered a temporary error and could not complete your request. Please try again in 30 seconds.

服务恢复正常后30分钟左右,并且无论何时负载测试发生它重复与上述相同的行为。我期望GAE根据负载进行自动调整,无需任何停机时间(使用多个实例),而只是崩溃或阻塞服务(日志中没有任何信息)。我的app.yaml配置是,

runtime: java 
env: flex 
service: hello-service 
automatic_scaling: 
    min_num_instances: 1 
    max_num_instances: 10 

我有点卡住了这个,任何帮助将不胜感激。提前致谢。

+0

你在日志查看器中看到什么? https://cloud.google.com/appengine/docs/flexible/python/writing-application-logs#viewing_logs –

+0

请参阅https://stackoverflow.com/questions/38012797/google-app-engine-502-bad-gateway -with-nodejs – user7294900

+0

@ user7294900我已将其更改为app.yaml中的手动缩放。但是,我无法找到从控制台中的“Google拥有”VM切换到“自己拥有”VM的方式。我无法在GCE区域找到实例。此外,我在日志中获得的详细错误是在此链接* https://jpst.it/13hHk*。 – KingKari

回答

2

解决方案是增加资源配置,详情如下。

Given that I did not set a resource parameter, it defaulted to the pre-defined values for both CPU and Memory. In this case, the default memory was set at 0.6GB. App Engine Flex instances uses about 0.4GB for overhead processes. Given Java is known to consume higher memory, there is a great likelihood that the overhead processes consumed more than the approximate 0.4GB value. Now instances in App Engine are restarted due to a variety of reasons including optimization due to memory use. This explains why your instances went off and it shows Tomcat is starting up (they got restarted) and ends up in 502 error due to the nginx is not able to complete the request. Fixing the above may lessen if not completely eliminate the 502s.

当我指定了资源属性并增加了app.yaml 502中的配置后,错误似乎消失了。

+0

感谢KingKari!我有同样的问题,不知道如何解决它你的如此lution为我工作。 –

相关问题