php如何使服务负载均衡权重控制生效?

Open
#6 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
php

Research direction

The issue does not name any PHP files or tests. Start by locating the service-consumer load-balancing implementation and compare its behavior with the referenced ConsumerApplication.java and NacosRule example. Done means weights configured in the Nacos console affect PHP service selection rather than always using round-robin.

Written by the indexing model from the issue text.

Description

java服务是这样的:
实现在Nacos控制台上配置服务权重
Nacos默认是轮询。此时在控制台上修改服务的权重是无效的,仍然是轮询。

可以在消费者Consumer的代码上面加上:

ConsumerApplication.java

@Bean
@Scope(value = "prototype")
public IRule loadBalanceRule()
{
return new NacosRule();
}
这样就可以支持在控制台上手动配置权重了。
————————————————
版权声明:本文为CSDN博主「mxb1234567」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/mxb1234567/article/details/109532872

Dominant language
PHP
Stars
22
Forks
14
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from hyperf/nacos

All issues in hyperf/nacos

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.