gpt4 book ai didi

java - containarized shinyproxy 非常慢

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:01:11 25 4
gpt4 key购买 nike

我使用堆栈部署了一个 shinyapps:R、docker 和 shinyproxy,到目前为止,这些工具非常好,用户很满意。然而,我在负载平衡方面遇到了一些困难,这样我就可以在解决方案上运行更新时扩展并停止打扰用户。

建议来自 https://www.shinyproxy.io/shinyproxy-containers/ ,我经历了这个过程,但使用了 https://github.com/openanalytics/shinyproxy-config-examples/tree/master/02-containerized-docker-engine容器化的 docker 引擎。当我运行未容器化的 java -jar shinyproxy-2.0.3.jar 时,我的解决方案运行完美。 但现在当我将它容器化时,它变得非常非常慢,事实上,即使内部网络处于 Activity 状态,当我尝试打开它们时容器也会崩溃。

目前我只是想测试容器化 shinyproxy 是否可以在不给我问题但失败的情况下工作。

我在服务器上的Nginx配置

server {

root /var/www/html;

# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;

server_name qnumsolutions.com www.qnumsolutions.com;

location / {
proxy_pass http://127.0.0.1:8080/;

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 600s;

proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Protocol $scheme;
}

listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/qnumsolutions.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/qnumsolutions.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}

Shinyproxy 应用程序.yml

proxy:
title: The Operational Intelligence Solution
logo-url: http://qnum.co.za/wp-content/uploads/2018/03/OI-Solution-Icon.png
landing-page: /
heartbeat-rate: 100000
heartbeat-timeout: 600000
port: 8080
authentication: simple
container-log-path: ./container-logs
admin-groups: admin
usage-stats-url: http://159.65.95.235:8086/write?db=shinyproxy_usagestats
# Example: 'simple' authentication configuration
users:
- name: info@qnum.co.za
password: prupr1.
groups: admin
docker:
url: http://localhost:2375
port-range-start: 20000
specs:
- id: OISolution1
description: Application is designed to help organisations use advanced analytics to manage product visibility and variance
container-cmd: ["R", "-e shiny::runApp('/root/hostedoi')"]
container-image: oisolution
container-volumes: ["/home/shiny/database:/mnt/persistent1"]
access-groups: admin
- id: OISolution2
description: Application is designed to help organisations use advanced analytics to manage product visibility and variance
container-cmd: ["R", "-e shiny::runApp('/root/hostedoi1')"]
container-image: oisolution1
container-volumes: ["/home/shiny/database:/mnt/persistent1"]
access-groups: admin

logging:
file:
shinyproxy.log

jetty 文件

FROM openjdk:8-jre

RUN mkdir -p /opt/shinyproxy/
RUN wget https://www.shinyproxy.io/downloads/shinyproxy-2.0.3.jar -O /opt/shinyproxy/shinyproxy.jar
COPY application.yml /opt/shinyproxy/application.yml

WORKDIR /opt/shinyproxy/
CMD ["java", "-jar", "/opt/shinyproxy/shinyproxy.jar"]

最后 sudo docker ps yields

CONTAINER ID        IMAGE               COMMAND                  CREATED              STATUS              PORTS                    NAMES
bc396c8bd26a ois-shinyproxy "java -jar /opt/shin…" About a minute ago Up About a minute 0.0.0.0:8080->8080/tcp clever_beaver

我查阅的其他链接: https://fly.io/articles/load-balancing-a-fleet-of-docker-containers-using-fly/

非常感谢您的协助。

最佳答案

您的 usage-stats-url 似乎有问题。也许防火墙或其他东西阻止 ShinyProxy 到达这个目的地?我可以重现这种缓慢的行为,但当我评论这一行时它就消失了。

除此之外,您的 application.yml 中还有一些关于 Docker 的错误。我对其进行了一些改动,并设法在我的本地机器上使用此配置运行它(nginx.conf 和 Dockerfile 只是略作改动以满足我对 docker-compose 的需求):

proxy:
title: The Operational Intelligence Solution
logo-url: http://qnum.co.za/wp-content/uploads/2018/03/OI-Solution-Icon.png
landing-page: /
heartbeat-rate: 100000
heartbeat-timeout: 600000
port: 8080
authentication: simple
container-log-path: ./container-logs
admin-groups: admin
#usage-stats-url: http://159.65.95.235:8086/write?db=shinyproxy_usagestats
# Example: 'simple' authentication configuration
users:
- name: info@qnum.co.za
password: prupre35A21.
groups: admin
docker:
internal-networking: true
specs:
- id: 01_hello
display-name: Hello Application
description: Application which demonstrates the basics of a Shiny app
container-cmd: ["R", "-e", "shinyproxy::run_01_hello()"]
container-image: openanalytics/shinyproxy-demo
container-volumes: ["/tmp:/mnt/persistent1"]
container-network: shinyproxy_slow_default
access-groups: admin
- id: 06_tabsets
container-cmd: ["R", "-e", "shinyproxy::run_06_tabsets()"]
container-image: openanalytics/shinyproxy-demo
container-volumes: ["/tmp:/mnt/persistent1"]
container-network: shinyproxy_slow_default
access-groups: admin

logging:
file:
shinyproxy.log

我用 docker-compose 运行了所有东西,见:

version: "3.1"

services:
web:
image: nginx:alpine
ports:
- 80:80
- 443:443
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf


shinyproxy:
image: sp_test
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./application.yml:/opt/shinyproxy/application.yml

关于java - containarized shinyproxy 非常慢,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52278328/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com