-
Notifications
You must be signed in to change notification settings - Fork 89
use REST for nodetool info #100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@penberg please let us know what you think |
|
old: new: I tested with -T and it works well, too |
|
Some high-level comments: The approach makes tons of sense, and it's something we have discussed internally before too. We should indeed make the REST API parts of Scylla JMX available as a library for this effort. One option is to make a separate "scylla-api-java.git", which has the generally useful bits. @avikivity, what do you think? |
| List<Class<? extends Runnable>> commands = asList( | ||
| Help.class, | ||
| Info.class, | ||
| REST==true?RESTInfo.class:Info.class, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps it would be simpler to always have Info.class here and make that class internally switch between RESTInfo and JMXInfo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a good comment ... I wanted to avoid modifying Info class as we consume it from upstream - so if we will merge upstream, this approach(to modify loaded classes) should be easier to handle conflicts and we will know what should be ported where
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, it makes sense not to modify Info class directly, but what if we add a InfoWrapper class that we use here, which delegates to Info or RESTInfo?
| @Option(type = OptionType.GLOBAL, name = {"-pwf", "--password-file"}, description = "Path to the JMX password file") | ||
| private String passwordFilePath = EMPTY; | ||
|
|
||
| @Option(type = OptionType.GLOBAL, name = {"-R"}, description = "Use REST instead of JMX") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe elaborate more in the description. For example, something like this:
Use Scylla's REST API (when supported) instead of the Cassandra-compatible JMX protocol for operations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we actually want to get rid of this option :-)
I have it there to ease my testing and comparing if I miss functionality from old NodeProbe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to keep the option (and have it disabled by default) for one or two releases. But we certainly can switch over to REST altogether once it's proven stable in production.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will get confusing when we default to it.
Pekka, if you want an option here, I'd like to suggest something like --probe=[rest|jmx] or --proto so we can choose any, and not only an enable-style flag so we can switch between both
| // } catch (UnknownHostException e) { | ||
| // e.printStackTrace(); //TODO fix DNS name lookup error | ||
| // } | ||
| // return client.getStringValue("/snitch/datacenter", queryParams, 10000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the commented out code will be removed from the final pull request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct, this is a very early draft, so no cleanup was done
|
I force pushed new update, hopefully it still keeps some history, seems comments are still here :-) |
|
Overall, the pull request makes sense to me. I think |
|
@haaawk @elcallio could give your insights on the approach too? |
|
@tarzanek I am generally for this, though we have not done this earlier because (apparently?) there are customers relying on JMX supprt (not for nodetool, but third party stuff). |
|
piotr [2:57 PM] but -protocol=rest |
|
Btw, before we can even think of making nodetool REST-only, the REST api needs to support HTTPS/TLS. JMX connectivity can be secured on Java level, and scylla-jmx to localhost w.o. security is probably fine, but for remote client to REST api, both SSL + auth is really needed. |
Some background here: Indeed we won't be able to retire scylla-jmx by doing this, since there are other consumers (even when we finish the conversion). However we're seeing scylla-jmx slow down nodetool in some queries, and even the people who need no other API are paying the price. The goal, at least at first, is to convert nodetool, and then be able to disable scylla-jmx (or just leave it there, running doing nothing) for the customers who don't need it. |
|
I addressed all the comments, however I lack a proper packaging test (so far I was running this from my workspace dir and only tried the artifact target) |
|
ok, packaging tests failed after packaging, I lack host and port support for REST, fixing now, |
| @Option(type = OptionType.GLOBAL, name = {"-p", "--port"}, description = "Remote jmx agent port number") | ||
| private String port = "7199"; | ||
|
|
||
| @Option(type = OptionType.GLOBAL, name = {"-o", "--restport"}, description = "Remote Scylla REST port number") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpicking short and long version should at least attempt to be similar
| @Option(type = OptionType.GLOBAL, name = {"-pwf", "--password-file"}, description = "Path to the JMX password file") | ||
| private String passwordFilePath = EMPTY; | ||
|
|
||
| @Option(type = OptionType.GLOBAL, name = {"-r", "--protocol"}, description = "Use rest(default, only for what is ported) or jmx(legacy) protocol") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpicking again, the -r is not a great short version of --protocol
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should add a scylla clause
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A general comment, why do we need to replace the Info class at all?
If we replace the probe part, the rest should be transparent, right?
This way it will be easier to follow upstream changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the problem is that the probe methods use mxbeans for DAOs, so this is to get rid of mxbeans in REST part completely without changing much of original classes
obviously this creates later an update problem if we will sync with upstream(but the problem will be there anyways), but it will get us rid of mxbeans and merges with upstream should be easier to sync with modified classes(that use the mxbeans methods from probe)
| /** | ||
| * REST client operations for Scylla. | ||
| */ | ||
| public class RESTNodeProbe extends NodeProbe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For testing during the transition phase, we can use an empty RESTNodeProbe and gradually add override methods.
What we don't override will be taken from NodeProbe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am calling super() now to parent jmx so fallback is to jmx where not implemented.
Are you suggesting to just return empty values instead?
|
an alternative (I'm not sure what the code impact would be) to create a fake jmx implementation layer, add the scylla-jmx classes inside the nodetool so nodeprobe would use it directly. We can probably do that by changing the getter function on NodeProbe |
interesting - so all the jmx mxbean code building would happen in one jvm - which is actually what we want to get rid of (it grows too much and is too slow) |
|
On Friday, July 26, 2019, Lubos Kosco ***@***.***> wrote:
an alternative (I'm not sure what the code impact would be) to create a
fake jmx implementation layer, add the scylla-jmx classes inside the
nodetool so nodeprobe would use it directly.
We can probably do that by changing the getter function on NodeProbe
interesting - so all the jmx mxbean code building would happen in one jvm
- which is actually what we want to get rid of (it grows too much and is
too slow)
how it would however happen in one JVM is a question, I can try if I will
have spare time, but until then current approach seems just more obvious
(unless somewhere the mxbean caching has better response than querying REST
API layer)
I think that without the jmx part it would work faster.
I've looked at node probe code and it's quite straightforward.
The big advantage is that there will be no code replication and minimal
dependency between our code and cassandra
—
… You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#100?email_source=notifications&email_token=AAQFDPZG3SJKMUWBROM222LQBLCK3A5CNFSM4HZSQ4O2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD24C5JQ#issuecomment-515387046>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAQFDP7NXY5PQS3MPI7AUF3QBLCK3ANCNFSM4HZSQ4OQ>
.
|
|
closing in favour of #121 |
NOTE:
the important classes to review are RESTInfo.java and RESTNodeProbe.java (do ignore jmx/api namespace, it's 1-1 copy from scylla-jmx)
this is WIP, so proof of concept as such, we wanted to avoid JMX layer in between
when reviewing RESTNodeProbe -
"super." means it is just fallback to old jmx layer in NodeProbe
-R for command line is used temporarily so I can easily switch between new and old probe
build-test, stress-build is removed in build.xml just for me to build faster
I added classes from jmx/api/ from https://github.com/scylladb/scylla-jmx repo - can we make a dependency on it so we don't duplicate stuff?
performance wise for my small test the result is the same, but now there is no jmx layer in between
(note that we still connect to jmx for fallback commands even if -R is used!)
and last warning - API client doesn't use command line hostname+port yet, so I know this code fails when run against remote host