-
Notifications
You must be signed in to change notification settings - Fork 445
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
Improve/standardize rate limiting logic in Monitor #4894
base: 2.1
Are you sure you want to change the base?
Conversation
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.
Remove the age-off logic that was being done in the fetch() methods. It should be noted that the functionality has slightly changed. Since we just re-create a new map whenever the data is refreshed in the fetch() methods, there are no old values that need to be aged off.
That is a nice simplification.
Yea definitely nice to be able to remove some code. Wasn't sure if this would be an issue though since before, the maps would contain values that would only be aged off after they were 15 minutes old. And now, since the data is recreated once every minute, all of the returned data will only ever be that old. Not too sure what the implications of this are or what the old values were being used for. |
I misread that code when I was reviewing. I thought they were aging off after 15 milliseconds, so did not think it was an issue. But its actually 15 minutes. It would be good to understand that change in behavior a bit better. So it seems like some things used to hang around for 15 minutes in the monitor display even after they were gone? |
Yea, so after looking at the code a bit more I think that the purpose of the age-off logic was to remove entries whose server was no longer present. The code that collects this data iterates through each server returned from |
@DomGarguilo for these these dead servers that hang around in the monitor for 15mins, do you know if their last contact time continues to increase in monitor display? |
Okay so i was a bit mistaken. The info for servers that have dies did stick around in the map and then it depends on what the calling code does with it. For example, Edit: I am also seeing this scenario where I start a script that scans a table on a running scan server, then once that scan appears on the active scans page in the monitor, I kill the scan server and eventually it looks like that scan from the script starts running on the tserver. At that point the active scans page shows two active scans, one on the dead scan server and that same scan on a tserver. This seems like a bug to me. |
Regarding my previous comment: I looked into the other spots where data was being pulled from these maps in the |
} | ||
return Map.copyOf(tserverScans); | ||
public Map<HostAndPort,ScanStats> getScans() { | ||
return tserverScansSupplier.get(); |
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.
It looks like these methods returned an immutable collection previously, but might not be doing that now. Might want to change the fetch* methods to return immutable collections.
This PR uses Guavas
Suppliers.memoizeWithExpiration()
for caching, replacing the manual caching logic. This allows us to:synchronized
from the get methods sinceSuppliers.memoizeWithExpiration()
is thread safefetch()
methods that update the data, directly return the data instead of using these maps. Thesefetch()
methods are called directly from the suppliers now.fetch()
methods. It should be noted that the functionality has slightly changed. Since we just re-create a new map whenever the data is refreshed in thefetch()
methods, there are no old values that need to be aged off.