我有一个跨越 4 种服务器类型的 Spring Cloud 微服务应用程序:一个安全网关、两个 UI 服务器和一个 REST API 服务器。其中每一个都将在生产环境中的自己的 VM 上运行:REST 服务器的 4 个服务器实例和每个其他服务器的 2 个实例。
该系统预计将为大约 30,000 名用户提供服务。
服务发现由 Eureka 提供。我有两个用于故障转移的 Eureka 服务器。
共享 HTTP session 由 Spring Session 和 Spring Data Redis 提供,在参与服务器上使用 @EnableRedisHttpSession 注释。
我决定为 Redis 设置 3 个虚拟机(“示例 2:使用三个盒子的基本设置”,网址为:http://redis.io/topics/sentinel)。
每个VM都会运行一个Redis服务器和一个Redis sentinel进程(其中一个Redis服务器为主,两个实例为从)
这一切在开发机器和系统测试机器上都运行良好,主要是在同一台服务器上运行所有进程。
我现在正转向使用多个虚拟机在类生产环境中运行性能测试。我想得到已经在生产中具有类似 Spring Cloud 设置的开发人员的一些反馈和建议:
这是我的主 Redis 服务器的配置。从站几乎相同,只是端口不同,表明它们是主站的从站:
daemonize no
port 6379
dbfilename "dump6379.rdb"
dir "/Users/odedia/Work/Redis/6379"
pidfile "/Users/odedia/Work/Redis/redis6379.pid"
#logfile "/Users/odedia/Work/Redis/redis6379.log"
tcp-backlog 511
timeout 0
tcp-keepalive 60
loglevel notice
databases 16
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
slave-serve-stale-data yes
slave-read-only no
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
slave-priority 100
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events "gxE"
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-entries 512
list-max-ziplist-value 64
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
aof-rewrite-incremental-fsync yes
这是一个 Redis 哨兵配置:
port 5000
sentinel monitor mymaster 127.0.0.1 6379 2
sentinel down-after-milliseconds mymaster 5000
sentinel failover-timeout mymaster 5000
sentinel config-epoch mymaster 59
这是 Eureka 服务器的 application.yml:
server:
port: 1111
eureka:
instance:
hostname: localhost
client:
serviceUrl:
defaultZone: https://${eureka.instance.hostname}:${server.port}/eureka/
registerWithEureka: false #Dont register yourself with yourself...
fetchRegistry: false
server:
waitTimeInMsWhenSyncEmpty: 0
spring:
application:
name: eureka
这里是网关服务器的 application.yml,它负责基于 Zuul 的路由:
# Spring properties
spring:
application:
name: gateway-server # Service registers under this name
redis:
sentinel:
master: mymaster
nodes: 127.0.0.1:5000,127.0.0.1:5001,127.0.0.1:5002
server:
port: 8080
security:
sessions: ALWAYS
zuul:
retryable: true #Always retry before failing
routes:
ui1-server: /ui1/**
ui2-server: /ui2/**
api-resource-server: /rest/**
# Discovery Server Access
eureka:
client:
serviceUrl:
defaultZone: https://localhost:1111/eureka/
instance:
hostname: localhost
metadataMap:
instanceId: ${spring.application.name}:${spring.application.instance_id:${random.value}}
hystrix:
command:
default:
execution:
isolation:
strategy: THREAD
thread:
timeoutInMilliseconds: 40000 #Timeout after this time in milliseconds
ribbon:
ConnectTimeout: 5000 #try to connect to the endpoint for 5 seconds.
ReadTimeout: 50000 #try to get a response after successfull connection for 5 seconds
# Max number of retries on the same server (excluding the first try)
maxAutoRetries: 1
# Max number of next servers to retry (excluding the first server)
MaxAutoRetriesNextServer: 2
最佳答案
我根据使用 Spring Data Redis 进行生产的经验写了一篇文章,感兴趣的人可以在这里找到。
关于redis - Spring Cloud、Spring Data Redis 和 Eureka 的生产注意事项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35847615/
我已经在Sinatra上创建了应用程序,它代表了一个简单的API。我想在生产和开发上进行部署。我想在部署时选择,是开发还是生产,一些方法的逻辑应该改变,这取决于部署类型。是否有任何想法,如何完成以及解决此问题的一些示例。例子:我有代码get'/api/test'doreturn"Itisdev"end但是在部署到生产环境之后我想在运行/api/test之后看到ItisPROD如何实现? 最佳答案 根据SinatraDocumentation:EnvironmentscanbesetthroughtheRACK_ENVenvironm
您如何在Rails中的实时服务器上进行有效调试,无论是在测试版/生产服务器上?我试过直接在服务器上修改文件,然后重启应用,但是修改好像没有生效,或者需要很长时间(缓存?)我也试过在本地做“脚本/服务器生产”,但是那很慢另一种选择是编码和部署,但效率很低。有人对他们如何有效地做到这一点有任何见解吗? 最佳答案 我会回答你的问题,即使我不同意这种热修补服务器代码的方式:)首先,你真的确定你已经重启了服务器吗?您可以通过跟踪日志文件来检查它。您更改的代码显示的View可能会被缓存。缓存页面位于tmp/cache文件夹下。您可以尝试手动删除
作为新的阿里云用户,您可以50免费试用多种优惠,价值高达1,700美元(或8,500美元)。这将让您了解和体验阿里云平台上提供的一系列产品和服务。如果您以个人身份注册免费试用,您将获得价值1,700美元的优惠。但是,如果您是注册公司,您可以选择企业免费试用,提交基本信息通过企业实名注册验证,即可开始价值$8,500的免费试用!本教程介绍了如何设置您的帐户并使用您的免费试用版。关于免费试用在我们开始此试用之前,您还必须遵守以下条款和条件才能访问您的免费试用:只有在一年内创建的账户才有资格获得阿里云免费试用。通过此免费试用优惠,用户可以免费试用免费试用活动页面上列出的每种产品一次。如果您有多个帐
目录SpringBootStarter是什么?以前传统的做法使用SpringBootStarter之后starter的理念:starter的实现: 创建SpringBootStarter步骤在idea新建一个starter项目、直接执行下一步即可生成项目。 在xml中加入如下配置文件:创建proterties类来保存配置信息创建业务类:创建AutoConfiguration测试如下:SpringBootStarter是什么? SpringBootStarter是在SpringBoot组件中被提出来的一种概念、简化了很多烦琐的配置、通过引入各种SpringBootStarter包可以快速搭建出一
我有带有gemwebsocket-rails0.7的Rails3.2应用程序。在开发机上,一切正常在生产环境中,我使用Nginx/1.6作为代理服务器,Unicorn作为http服务器。Thin用于独立模式(在https://github.com/websocket-rails/websocket-rails/wiki/Standalone-Server-Mode之后)。nginx配置:location/websocket{proxy_passhttp://localhost:3001/websocket;proxy_http_version1.1;proxy_set_headerUp
有时您会制作特定于项目的gem。这有助于将一些“责任”从主Rails应用程序中抽象出来并转移到一个更加模块化的地方。gem将位于您应用程序的此处:gem'example_gem',path:'./example_gem'你捆绑,一切都很好。现在,您gitinitgem并将其存储在github上它自己的repo中。您尝试这样做以使其对开发人员友好:group:development,:testdogem'example_gem',path:'./example_gem'endgroup:productiondogem'example_gem',github:'company/exampl
我正在将我的第一个Rails应用程序放到互联网上,我已经阅读了有关安全性的Rails指南并实现了其中列出的要点,但有兴趣了解其他信息吗?另外,我目前将上传的内容存储在公共(public)/文档中,这样可以吗?我注意到没有保护目录的htaccess文件。 最佳答案 如果您想保密,将上传的内容存储在可预测的位置是个坏主意。如果您不关心访问它的人,那也没关系。使用.htaccess密码保护目录是一个很好的解决方案。您应该使用Acunetx测试您的应用程序是否存在漏洞($$)或Wapiti(开源)。您还应该阅读:Whatshouldadev
(免责声明:在Heroku上部署Sinatra的新手。)我看过http://www.sinatrarb.com/configuration.html它告诉我set:environment,:production。我的问题是,我该如何指定它:“在Heroku中,将环境设置为生产环境,否则留在测试/开发中。”此外,即使在set:environment,:production这行之后,我也不认为它在工作,因为当我尝试在本地rackup应用程序时,它是仍在运行(当我知道(或者我认为我知道)它不应该因为我没有在我的计算机上安装postgres时)。gem文件group:productiondog
我想将我的基础架构迁移到jRuby。我看到的最完整的选项是torquebox。任何人都可以分享一些关于它的东西吗?与tomcat/jetty相比? 最佳答案 我正在使用TorqueBox1.0ReleaseCandidate作为24x7关键任务生产解决方案。它已被用作我项目中所有新开发的首选平台,取代了非常昂贵的商业ESB。虽然HornetQ还没有(还)取代我们企业的企业JMS提供者,但我们正在大量使用HornetQ来处理越来越多的松散耦合的JRuby组件。在我看来,TorqueBox是具有内置高可用性功能的世界级应用服务器、高性能
我正在尝试将数据从我的生产数据库传输到我的登台数据库,但没有成功。我正在关注heroku的相关文档:http://devcenter.heroku.com/articles/pgbackups#transfers这些是我运行的命令...$herokuaddons:addpgbackups--remotestaging$herokuaddons:addpgbackups--remoteproduction$herokupgbackups:capture--remoteproduction$herokupgbackups:restoreDATABASE`herokupgbackups:ur