Refine search
@Override public int getPeerNodeConnectTimeoutMs() { return configInstance.getIntProperty( namespace + "peerNodeConnectTimeoutMs", 1000).get(); }
public int getIdleConnectionTimeout() { // connection pool idle timeout based on client heart beat interval. Heart beat default value is 30. DynamicIntProperty property = DynamicPropertyFactory.getInstance() .getIntProperty("servicecomb.service.registry.client.timeout.idle", DEFAULT_TIMEOUT_IN_SECONDS * 2); int timeout = property.get(); return timeout < 1 ? DEFAULT_TIMEOUT_IN_SECONDS * 2 : timeout; }
public static void addHttp2DefaultConfig(ChannelConfig config) { config.add(new ChannelConfigValue(CommonChannelConfigKeys.maxConcurrentStreams, new DynamicIntProperty("server.http2.max.concurrent.streams", CommonChannelConfigKeys.maxConcurrentStreams.defaultValue()).get())); config.add(new ChannelConfigValue(CommonChannelConfigKeys.initialWindowSize, new DynamicIntProperty("server.http2.initialwindowsize", CommonChannelConfigKeys.initialWindowSize.defaultValue()).get())); config.add(new ChannelConfigValue(CommonChannelConfigKeys.maxHttp2HeaderTableSize, new DynamicIntProperty("server.http2.maxheadertablesize", 65536).get())); config.add(new ChannelConfigValue(CommonChannelConfigKeys.maxHttp2HeaderListSize, new DynamicIntProperty("server.http2.maxheaderlistsize", 32768).get())); // Override this to a lower value, as we'll be using ELB TCP listeners for h2, and therefore the connection // is direct from each device rather than shared in an ELB pool. config.add(new ChannelConfigValue(CommonChannelConfigKeys.maxRequestsPerConnection, new DynamicIntProperty("server.connection.max.requests", 4000).get())); }
public static int getConfigVal(String config, int defaultValue) { DynamicIntProperty dynamicIntProperty = DynamicPropertyFactory.getInstance().getIntProperty(config, defaultValue); cfgCallback.computeIfAbsent(config, key -> { dynamicIntProperty.addCallback(() -> { int newValue = dynamicIntProperty.get(); String cfgName = dynamicIntProperty.getName(); //store the value in config center map and check for next requests. FaultInjectionUtil.setConfigCenterValue(cfgName, new AtomicInteger(newValue)); LOGGER.info("{} changed to {}", cfgName, newValue); }); return config; }); return dynamicIntProperty.get(); } }
@Override public int getIntProperty(String propertyName, IntConsumer consumer, int defaultValue) { DynamicIntProperty prop = propertyFactoryInstance().getIntProperty(propertyName, defaultValue); prop.addCallback(() -> consumer.accept(prop.get())); return prop.get(); }
public EVCacheExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, RejectedExecutionHandler handler, String name) { super(corePoolSize, maximumPoolSize, keepAliveTime, unit, new LinkedBlockingQueue<Runnable>(), new ThreadFactoryBuilder().setDaemon(true).setNameFormat( "EVCacheExecutor-" + name + "-%d").build()); this.name = name; maxAsyncPoolSize = EVCacheConfig.getInstance().getDynamicIntProperty("EVCacheExecutor." + name + ".max.size", maximumPoolSize); setMaximumPoolSize(maxAsyncPoolSize.get()); coreAsyncPoolSize = EVCacheConfig.getInstance().getDynamicIntProperty("EVCacheExecutor." + name + ".core.size", corePoolSize); setCorePoolSize(coreAsyncPoolSize.get()); setKeepAliveTime(keepAliveTime, unit); maxAsyncPoolSize.addCallback(new Runnable() { public void run() { setMaximumPoolSize(maxAsyncPoolSize.get()); } }); coreAsyncPoolSize.addCallback(new Runnable() { public void run() { setCorePoolSize(coreAsyncPoolSize.get()); prestartAllCoreThreads(); } }); setupMonitoring(name); }
public ChainedDynamicProperty.IntProperty getChainedIntProperty(String overrideKey, String primaryKey, int defaultValue, Runnable listener) { final String mapKey = overrideKey + primaryKey; ChainedDynamicProperty.IntProperty prop = (ChainedDynamicProperty.IntProperty) fastPropMap.get(mapKey); if (prop != null) return prop; final DynamicIntProperty baseProp = new DynamicIntProperty(primaryKey, defaultValue); prop = new ChainedDynamicProperty.IntProperty(overrideKey, baseProp); fastPropMap.put(mapKey, prop); if(listener != null) { baseProp.addCallback(listener); prop.addCallback(listener); } return prop; }
public EVCacheInMemoryCache(String appName, Transcoder<T> tc, EVCacheImpl impl) { this.appName = appName; this.tc = tc; this.impl = impl; final Runnable setupCache = new Runnable() { public void run() { setupCache(); } }; this._cacheDuration = EVCacheConfig.getInstance().getChainedIntProperty(appName + ".inmemory.cache.duration.ms", appName + ".inmemory.expire.after.write.duration.ms", 0, setupCache); this._exireAfterAccessDuration = EVCacheConfig.getInstance().getDynamicIntProperty(appName + ".inmemory.expire.after.access.duration.ms", 0); this._exireAfterAccessDuration.addCallback(setupCache); this._refreshDuration = EVCacheConfig.getInstance().getDynamicIntProperty(appName + ".inmemory.refresh.after.write.duration.ms", 0); this._refreshDuration.addCallback(setupCache); this._cacheSize = EVCacheConfig.getInstance().getDynamicIntProperty(appName + ".inmemory.cache.size", 100); this._cacheSize.addCallback(setupCache); this._poolSize = EVCacheConfig.getInstance().getDynamicIntProperty(appName + ".thread.pool.size", 5); this._poolSize.addCallback(new Runnable() { public void run() { initRefreshPool(); } }); setupCache(); setupMonitoring(appName); }
public int getHeartBeatRequestTimeout() { DynamicIntProperty property = DynamicPropertyFactory.getInstance() .getIntProperty("servicecomb.service.registry.client.timeout.heartbeat", DEFAULT_REQUEST_HEARTBEAT_TIMEOUT_IN_MS); int timeout = property.get(); return timeout < 1 ? DEFAULT_REQUEST_HEARTBEAT_TIMEOUT_IN_MS : timeout; }
@Override public int getRateLimiterFullFetchAverageRate() { return rateLimiterFullFetchAverageRate.get(); }
public static ChannelConfig defaultChannelConfig() { ChannelConfig config = new ChannelConfig(); config.add(new ChannelConfigValue(CommonChannelConfigKeys.maxConnections, new DynamicIntProperty("server.connection.max", 20000).get())); config.add(new ChannelConfigValue(CommonChannelConfigKeys.maxRequestsPerConnection, new DynamicIntProperty("server.connection.max.requests", 20000).get())); config.add(new ChannelConfigValue(CommonChannelConfigKeys.maxRequestsPerConnectionInBrownout, new DynamicIntProperty("server.connection.max.requests.brownout", CommonChannelConfigKeys.maxRequestsPerConnectionInBrownout.defaultValue()).get())); config.add(new ChannelConfigValue(CommonChannelConfigKeys.connectionExpiry, new DynamicIntProperty("server.connection.expiry", CommonChannelConfigKeys.connectionExpiry.defaultValue()).get())); config.add(new ChannelConfigValue(CommonChannelConfigKeys.idleTimeout, new DynamicIntProperty("server.connection.idle.timeout", 65 * 1000).get())); config.add(new ChannelConfigValue(CommonChannelConfigKeys.httpRequestReadTimeout, new DynamicIntProperty("server.http.request.read.timeout", 5000).get())); // For security, default to NEVER allowing XFF/Proxy headers from client. config.add(new ChannelConfigValue(CommonChannelConfigKeys.allowProxyHeadersWhen, StripUntrustedProxyHeadersHandler.AllowWhen.NEVER)); config.set(CommonChannelConfigKeys.withProxyProtocol, true); config.set(CommonChannelConfigKeys.preferProxyProtocolForClientIp, true); config.add(new ChannelConfigValue(CommonChannelConfigKeys.connCloseDelay, new DynamicIntProperty("zuul.server.connection.close.delay", 10).get())); return config; }
public EVCacheScheduledExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, RejectedExecutionHandler handler, String name) { super(corePoolSize, handler); this.name = name; maxAsyncPoolSize = EVCacheConfig.getInstance().getDynamicIntProperty("EVCacheScheduledExecutor." + name + ".max.size", maximumPoolSize); setMaximumPoolSize(maxAsyncPoolSize.get()); coreAsyncPoolSize = EVCacheConfig.getInstance().getDynamicIntProperty("EVCacheScheduledExecutor." + name + ".core.size", corePoolSize); setCorePoolSize(coreAsyncPoolSize.get()); setKeepAliveTime(keepAliveTime, unit); final ThreadFactory asyncFactory = new ThreadFactoryBuilder().setDaemon(true).setNameFormat( "EVCacheScheduledExecutor-" + name + "-%d").build(); setThreadFactory(asyncFactory); maxAsyncPoolSize.addCallback(new Runnable() { public void run() { setMaximumPoolSize(maxAsyncPoolSize.get()); } }); coreAsyncPoolSize.addCallback(new Runnable() { public void run() { setCorePoolSize(coreAsyncPoolSize.get()); prestartAllCoreThreads(); } }); setupMonitoring(name); }
this._poolSize.addCallback(callback); this._readTimeout = new ChainedDynamicProperty.IntProperty(appName + ".EVCacheClientPool.readTimeout", EVCacheClientPoolManager.getDefaultReadTimeout()); this._readTimeout.addCallback(callback); this._opQueueMaxBlockTime.addCallback(callback); this._operationTimeout = config.getDynamicIntProperty(appName + ".operation.timeout", 2500); this._operationTimeout.addCallback(callback); this._maxReadQueueSize = config.getDynamicIntProperty(appName + ".max.read.queue.length", 5); this._retryAcrossAllReplicas = config.getDynamicBooleanProperty(_appName + ".retry.all.copies", Boolean.FALSE);
@Override public int getPeerNodeReadTimeoutMs() { return configInstance.getIntProperty( namespace + "peerNodeReadTimeoutMs", 5000).get(); }
public int getInstancePullInterval() { DynamicIntProperty property = DynamicPropertyFactory.getInstance() .getIntProperty("servicecomb.service.registry.instance.pull.interval", DEFAULT_CHECK_INTERVAL_IN_S); int interval = property.get(); return interval < 0 ? DEFAULT_CHECK_INTERVAL_IN_S : interval; }
@Override public int getMaxBodySize() { return MAX_BODY_SIZE_PROP.get(); }
public static void addHttp2DefaultConfig(ChannelConfig config) { config.add(new ChannelConfigValue(CommonChannelConfigKeys.maxConcurrentStreams, new DynamicIntProperty("server.http2.max.concurrent.streams", CommonChannelConfigKeys.maxConcurrentStreams.defaultValue()).get())); config.add(new ChannelConfigValue(CommonChannelConfigKeys.initialWindowSize, new DynamicIntProperty("server.http2.initialwindowsize", CommonChannelConfigKeys.initialWindowSize.defaultValue()).get())); config.add(new ChannelConfigValue(CommonChannelConfigKeys.maxHttp2HeaderTableSize, new DynamicIntProperty("server.http2.maxheadertablesize", 65536).get())); config.add(new ChannelConfigValue(CommonChannelConfigKeys.maxHttp2HeaderListSize, new DynamicIntProperty("server.http2.maxheaderlistsize", 32768).get())); // Override this to a lower value, as we'll be using ELB TCP listeners for h2, and therefore the connection // is direct from each device rather than shared in an ELB pool. config.add(new ChannelConfigValue(CommonChannelConfigKeys.maxRequestsPerConnection, new DynamicIntProperty("server.connection.max.requests", 4000).get())); }
@Override public int getMaxThreadsForStatusReplication() { return configInstance.getIntProperty( namespace + "maxThreadsForStatusReplication", 1).get(); }
public MetricsBootstrapConfig() { msPollInterval = DynamicPropertyFactory.getInstance().getIntProperty(METRICS_WINDOW_TIME, DEFAULT_METRICS_WINDOW_TIME).get(); if (msPollInterval < 1000) { msPollInterval = 1000; } }