Yeal, currently the server address information is input from LiteClientConfig, and stored at AbstractLiteClient.eventMeshServerList. If we want to implement this feature, we may need to do two change. First, we need to change the address format at liteEventMeshAddr.liteEventMeshAddr, currently it is 127.0.0.1:10105;127.0.0.2:10105, we need to change to 127.0.0.1:10105:1;127.0.0.2:10105:1 the last number is weight. Second, when the consumer client or producer client initialize, we will process the address information and create the load strategy class, store the server address with the weight information at the load strategy we created. Each client need to create their own load strategy, this is not shared by all clients. So this is not a global load.
Thanks, Wenjun Ruan From: majorhe <[email protected]> Date: Monday, May 10, 2021 at 10:07 PM To: [email protected] <[email protected]> Subject: Re: [Discuss] Support multiple load balance strategy in sdk External Email Great, but there are still some points that we need to discuss in detail. For example, if we use the weight random or weight round-robin strategy, where is the weight information stored so that all clients can get it? Ruan, Wenjun <[email protected]> 于2021年5月8日周六 下午4:40写道: > > In current HTTP SDK, we use LiteProducer to publish messages. We store the > server address in the eventMeshServerList property of the LiteProducer, the > producer is responsible for the selection work. > > If we want to support multiple selection strategy, we can define a > interface named HostManager or HostSelector, we store the address in the > HostManager and it can have different implementation according to a > specific strategy. The producer uses the HostManager to do the selecte > work. The User can use a specific implementation by configuration. > > Best wish > Wenjun Ruan > From: Eason Chen <[email protected]> > Date: Saturday, May 8, 2021 at 3:47 PM > To: [email protected] <[email protected]> > Subject: Re: [Discuss] Support multiple load balance strategy in sdk > External Email > > Hi, > Good suggestion, could you describe your design based on current sdk? > > Eason > > On Sat, May 8, 2021 at 11:37 AM Ruan, Wenjun <[email protected]> > wrote: > > > Hi team, > > > > As mention in this issue< > > > https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fapache%2Fincubator-eventmesh%2Fissues%2F333&data=04%7C01%7Cweruan%40ebay.com%7Cbfa001a96aa54b61d70808d913bce139%7C46326bff992841a0baca17c16c94ea99%7C0%7C1%7C637562524217500010%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=xjgpzktz1apzGWwStcemmx6f5X4%2FBsU1ibMFAB3nfD8%3D&reserved=0>, > at present, if > > we use HTTP SDK to publish a message, the producer will use random > strategy > > to select the target server host, this may work well in most scenarios. > > But sometimes if the servers have different hardware we may want to use > the > > weighted polling method to select the server. > > > > So I suggest adding additional load strategy to choose server in SDK. > > > > Best wish, > > Wenjun Ruan > > >
