{"action":"reopened","issue":{"url":"https://api.github.com/repos/mybatis/mybatis-3/issues/116","labels_url":"https://api.github.com/repos/mybatis/mybatis-3/issues/116/labels{/name}","comments_url":"https://api.github.com/repos/mybatis/mybatis-3/issues/116/comments","events_url":"https://api.github.com/repos/mybatis/mybatis-3/issues/116/events","html_url":"https://github.com/mybatis/mybatis-3/issues/116","id":24056430,"number":116,"title":"Major bottleneck during cache refresh in Mybatis v3.2.2","user":{"login":"gerohsik","id":4155069,"avatar_url":"https://avatars.githubusercontent.com/u/4155069?v=3","gravatar_id":"","url":"https://api.github.com/users/gerohsik","html_url":"https://github.com/gerohsik","followers_url":"https://api.github.com/users/gerohsik/followers","following_url":"https://api.github.com/users/gerohsik/following{/other_user}","gists_url":"https://api.github.com/users/gerohsik/gists{/gist_id}","starred_url":"https://api.github.com/users/gerohsik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gerohsik/subscriptions","organizations_url":"https://api.github.com/users/gerohsik/orgs","repos_url":"https://api.github.com/users/gerohsik/repos","events_url":"https://api.github.com/users/gerohsik/events{/privacy}","received_events_url":"https://api.github.com/users/gerohsik/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mybatis/mybatis-3/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":{"login":"emacarron","id":1587939,"avatar_url":"https://avatars.githubusercontent.com/u/1587939?v=3","gravatar_id":"","url":"https://api.github.com/users/emacarron","html_url":"https://github.com/emacarron","followers_url":"https://api.github.com/users/emacarron/followers","following_url":"https://api.github.com/users/emacarron/following{/other_user}","gists_url":"https://api.github.com/users/emacarron/gists{/gist_id}","starred_url":"https://api.github.com/users/emacarron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emacarron/subscriptions","organizations_url":"https://api.github.com/users/emacarron/orgs","repos_url":"https://api.github.com/users/emacarron/repos","events_url":"https://api.github.com/users/emacarron/events{/privacy}","received_events_url":"https://api.github.com/users/emacarron/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/mybatis/mybatis-3/milestones/7","html_url":"https://github.com/mybatis/mybatis-3/milestones/3.3.0","labels_url":"https://api.github.com/repos/mybatis/mybatis-3/milestones/7/labels","id":595470,"number":7,"title":"3.3.0","description":"","creator":{"login":"emacarron","id":1587939,"avatar_url":"https://avatars.githubusercontent.com/u/1587939?v=3","gravatar_id":"","url":"https://api.github.com/users/emacarron","html_url":"https://github.com/emacarron","followers_url":"https://api.github.com/users/emacarron/followers","following_url":"https://api.github.com/users/emacarron/following{/other_user}","gists_url":"https://api.github.com/users/emacarron/gists{/gist_id}","starred_url":"https://api.github.com/users/emacarron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emacarron/subscriptions","organizations_url":"https://api.github.com/users/emacarron/orgs","repos_url":"https://api.github.com/users/emacarron/repos","events_url":"https://api.github.com/users/emacarron/events{/privacy}","received_events_url":"https://api.github.com/users/emacarron/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":22,"state":"open","created_at":"2014-03-12T21:18:30Z","updated_at":"2015-05-01T08:10:27Z","due_on":null,"closed_at":null},"comments":6,"created_at":"2013-12-10T18:44:13Z","updated_at":"2015-05-01T08:10:27Z","closed_at":null,"body":"USAGE\r\nOn an average we have 1000 concurrent clients that make calls that translate to exactly same set of DB queries. Our database does not change every second so we cache the DB queries for 5 minutes using MyBatis,\r\n<cache eviction=\"FIFO\" flushInterval=\"300000\" readOnly=\"true\" />\r\n\r\nPROBLEM\r\nServer handles the load comfortably except when cache refresh happens. At every cache refresh we see large number of errors.\r\n\r\nFINDINGS SO FAR\r\nLet's say 1000 clients call for query_1 which takes 5 seconds to execute. Until query_1 is completed, MyBatis makes DB calls for query_1 repeatedly and does not realize that query_1 is already in progress. So Mybatis makes hundreds of concurrent calls to DB for same query_1, effectively not using caching.\r\nThis overloads our DB and leads to request failures.\r\n\r\nThis is an urgent production issue, any fixes or workarounds will be greatly appreciated!"}}