-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Stop parsing tickets as HJSON #6134
Stop parsing tickets as HJSON #6134
Conversation
Thank you very much for submitting this pull request! What happened?The patch presented here seems to contain no adequate unit and/or integration tests. Patches that alter CAS core functionality without proper tests, regardless of how small they may seem, are automatically closed. By tests, we specifically mean, unit/integration/browser/functional tests; a description and series of instructions on how one may go about reproducing or testing the patch manually is excellent but not sufficient for acceptance. If the change-set here modifies CAS functionality that is extremely and obviously trivial (i.e. fixes a typo) or updates the CAS documentation or presents any other type of change that generally can be accepted without proper tests, please comment and explain on the pull request. What's next?Please re-open the pull request (or ask project maintainers to do this for you) when you're ready and have included tests to verify functionality. If you feel like you are not immediately available or have no time to work out test cases and steps to reproduce and verify the changes, that's not an issue. Please revisit the pull request as soon as it's convenient for you to resume work as your schedule allows. The pull request will wait for you right here. If you'd like to keep the patch around and open while you make progress, please mark the patch as
If you do not know how to write tests, please browse through the resources listed below and get started. If you get stuck, please feel free to ask for help. ResourcesFurthermore,
If you believe this message to be an error, please post your explanation here as a comment and it will be reviewed. SupportIf you are seeking assistance or have a question about your CAS deployment, please visit support options to learn more. Thanks again! |
I don't think there's a need to add any additional tests? |
I suggest finding something to write a test for, to get past the bot that will otherwise close the PR. If nothing else, maybe a unit test that shows the difference in time between parsing a ticket with and without the hson -> json conversion. |
@mmoayyed What do you think? |
In practice, with this modification, we're seeing a drop of around 40% in CPU usage on our CAS server. (Keeping in mind that the server also hosts the MongoDB used by CAS) |
How about a test that parses a ticket a hundred times as hson and json to demonstrate the speed difference? Even if the test gets deleted eventually, it would serve the purpose of getting your PR to stay open and reviewed. |
Thank you for the find and the change. The PR here cannot be accepted. The approach taken with extending base classes is not maintainable and cannot scale. You can imagine that if we add yet another variation of the parser or a change in settings, you would have a cartesian product of all implementations. Your changeset is also unnecessary for the master branch. Review what is done already as an example, and you're welcome to apply the same logic to other branches in maintenance, with small changes. Unless you're fixing a typo or changing a background color, tests are always a must. To verify the behavior, to show that you have actually tested this, and to communicate how the change works and what impact it makes. This is why the bot exists :) A screenshot of "it works better" is never acceptable, verifiable or reason to keep the change around intentionally or accidentally. Also, please don't write tests to make the bot happy. Write tests to test. |
Seems to be fixed in master in commit 2445f63 (together with some fixes specific to redis ticket registry) => now only RegisteredServiceJsonSerializer is doing HJSON |
New PRs based on 2445f63 :
|
We noticed that Apereo CAS spent a lot of time deserializing HJSON into JSON
Indeed, whenever we want to read a JSON, AbstractJacksonBackedStringSerializer calls org.hjson.JsonValue.readHjson(String).toString() to convert the String from HJSON to JSON.
Unfortunately this is very costly in terms of performance, whereas in most cases the String is already a JSON string.
This commit aims to stop converting from HJSON to JSON for Strings that may not have been written in HJSON (tickets, for example).