[ 
https://issues.apache.org/jira/browse/CASSANDRA-18438?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17737013#comment-17737013
 ] 

Maxwell Guo edited comment on CASSANDRA-18438 at 6/26/23 7:07 AM:
------------------------------------------------------------------

In my mind , for different cloud platform snitch, the only thing is to support 
the meta center so ,the snitch can get the region info about their virtual 
machine; we can see [alibaba snitch 
|https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/locator/AlibabaCloudSnitch.java]
 [aws snitch 
|https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/locator/Ec2Snitch.java]
 and [google cloud 
snitch|https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/locator/GoogleCloudSnitch.java]
  the main difference is the hard code : ZONE_NAME_QUERY_URL and the using http 
to query the region/zone info . 
as for ec2's multi region sitch , there is  some hard code for PULBLIC and 
PRIVATE IP , these IP URLs are different for different cloud platform but the 
logic to deal with these IP URLs are almost same.

So I think It is possible to be configurable.

The main reason I opened this issue is, the first time I add the [alibaba 
snitch 
|https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/locator/AlibabaCloudSnitch.java]
 I found that I copied almost all the logic from google cloud snitch , and  Now 
I found that  for there may be some cloud platforms that do not have their own 
snitch (if the number is 10 or more than 10)
,it may be not possible to add ten snitch for every cloud platform, and the 
entire cycle of writing code, testing, and release for cassandra will be very 
long. On the contrary, it will be very convenient to make it configurable.

The main reason why I haven't started this issue yet is still thinking about 
how to configure and what to configure.

Edit:
I'm also thinking about how to achieve forward compatibility.




was (Author: maxwellguo):
In my mind , for different cloud platform snitch, the only thing is to support 
the meta center so ,the snitch can get the region info about their virtual 
machine; we can see [alibaba snitch 
|https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/locator/AlibabaCloudSnitch.java]
 [aws snitch 
|https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/locator/Ec2Snitch.java]
 and [google cloud 
snitch|https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/locator/GoogleCloudSnitch.java]
  the main difference is the hard code : ZONE_NAME_QUERY_URL and the using http 
to query the region/zone info . 
as for ec2's multi region sitch , there is  some hard code for PULBLIC and 
PRIVATE IP , these IP URLs are different for different cloud platform but the 
logic to deal with these IP URLs are almost same.

So I think It is possible to be configurable.

The main reason I opened this issue is, the first time I add the [alibaba 
snitch 
|https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/locator/AlibabaCloudSnitch.java]
 I found that I copied almost all the logic from google cloud snitch , and  Now 
I found that  for there may be some cloud platforms that do not have their own 
snitch (if the number is 10 or more than 10)
,it may be not possible to add ten snitch for every cloud platform, and the 
entire cycle of writing code, testing, and release for cassandra will be very 
long. On the contrary, it will be very convenient to make it configurable.

The main reason why I haven't started this issue yet is still thinking about 
how to configure and what to configure.


> Refactor the code for public cloud platform snitch to be configurable
> ---------------------------------------------------------------------
>
>                 Key: CASSANDRA-18438
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-18438
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Local/Other
>            Reporter: Maxwell Guo
>            Assignee: Maxwell Guo
>            Priority: Normal
>             Fix For: 5.x
>
>
> Nowadays we have got about four public cloud platform snitchs : EC2 snitch 
> for aws, google cloud snitch for google cloud, alibaba cloud snitch for 
> alibaba cloud and multi region snitch for ec2. And the common place for the 
> first three is that we just need to query the zone center to get the ec2 / 
> ecs id , so I think we can refactor the code , and  if some new public cloud 
> platform want to add one more snitch for himself, there is no need to pull a 
> pr for him and  configure some options in yaml is enough .
> Besides it would be even better that we may reuse the multic region snitch 
> for ec2 for other public cloud platform.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to