[ https://issues.apache.org/jira/browse/KYLIN-2862?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
liyang resolved KYLIN-2862. --------------------------- Resolution: Fixed Fix Version/s: v2.2.0 > BasicClientConnManager in RestClient can't do well with syncing many query > severs > --------------------------------------------------------------------------------- > > Key: KYLIN-2862 > URL: https://issues.apache.org/jira/browse/KYLIN-2862 > Project: Kylin > Issue Type: Bug > Components: General > Affects Versions: v2.1.0 > Reporter: Fangyuan Deng > Assignee: Fangyuan Deng > Fix For: v2.2.0 > > Attachments: KYLIN-2862.0.patch, KYLIN-2862.1.patch > > > In KYLIN-2814 , it fixs some kinds of sync wipe fails. > After we use this patch , sync wipe fails still often happen, the log is > like this. > 2017-09-08 21:28:13,029 WARN [pool-10-thread-2] cachesync.Broadcaster:137 : > Thread failed during wipe cache at BroadcastEvent{entity=cube, event=update, > cacheKey=olap_nh_log_all_di_cube}, error msg: > java.lang.IllegalStateException: Invalid use of BasicClientConnManager: > connection still allocated. > Make sure to release the connection before allocating another one. > We search the code, then we found , the DefaultHttpClient uses > BasicClientConnManager as default ConnManager. > and the BasicClientConnManager is a simple connection manager that maintains > only one connection at a time. Even though this class is thread-safe it ought > to be used by one execution thread only. > if we have many query servers, the BasicClientConnManager will be > bottleneck. > so we use PoolingClientConnectionManager instead, which can manages a pool > of client connections and is able to service connection requests from > multiple execution threads. > Then everything goes fine. the code is below > final PoolingClientConnectionManager cm = new > PoolingClientConnectionManager(); > cm.setDefaultMaxPerRoute(20); > cm.setMaxTotal(200); > client = new DefaultHttpClient(cm, httpParams); > see more about BasicClientConnManager and PoolingClientConnectionManager > http://hc.apache.org/httpcomponents-client-ga/tutorial/html/connmgmt.html#d5e619 -- This message was sent by Atlassian JIRA (v6.4.14#64029)