Skip to content
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

[SCB-627] Client Request Timeout support for operation/schema/service level #744

Merged
merged 3 commits into from Jun 5, 2018

Conversation

maheshrajus
Copy link
Contributor

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Make sure there is a JIRA issue filed for the change (usually before you start working on it). Trivial changes like typos do not require a JIRA issue. Your pull request should address just this issue, without pulling in other changes.
  • Each commit in the pull request should have a meaningful subject line and body.
  • Format the pull request title like [SCB-XXX] Fixes bug in ApproximateQuantiles, where you replace SCB-XXX with the appropriate JIRA issue.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Run mvn clean install to make sure basic checks pass. A more thorough check will be performed on your pull request automatically.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

@asifdxtreme asifdxtreme requested review from wujimin, WillemJiang and liubao68 and removed request for wujimin May 31, 2018 08:32
@coveralls
Copy link

coveralls commented May 31, 2018

Coverage Status

Coverage increased (+0.004%) to 87.526% when pulling 09a8bbb on maheshrajus:master into fc9c7f4 on apache:master.

* @param config config parameter
* @return long value
*/
private static long getConfigParam(String config, long defaultValue) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you can refer to https://github.com/apache/incubator-servicecomb-java-chassis/blob/master/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/Configuration.java to make this method simpler.

And you do not need to cache configure center values, since DynamicPropertyFactory.getInstance().getLongProperty will get the latest value for you.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

String cfgName = dynamicLongProperty.getName();

//store the value in config center map and check for next requests.
configCenterValue.put(cfgName, new AtomicLong(newValue));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why need Atomic logic?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we will modify to long. multiple threads will not operate on this map so atomic not required in this case.

*/
private static long getConfigValue(String config) {
//first need to check in config center map which has high priority.
if (configCenterValue.containsKey(config)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why named "configCenterValue", it's just current value, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok. we will name accordingly

String schema = invocation.getSchemaId();
String serviceName = invocation.getMicroserviceName();

config = CONSUMER_REQUEST_TIMEOUT + "." + serviceName + "." + schema + "." + operationName;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try logic for every invocation is not a good idea
it's not better than liubao's suggestion, but more complex.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i just read and passed operation name/schema id/service name to the method now. any suggestion on how to get operation name/schema/service name without invocation object ?

request:
timeout:
jaxrs:
clientreqtimeout:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how to express jaxrs timeout is x, but jaxrs.clientreqtimeout is y, and jaxrs.clientreqtimeout.add is z

below is not a valid yaml:

a: 10
  b: 20

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok. we will modify the key structure.

@liubao68 liubao68 merged commit cb2be07 into apache:master Jun 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants