{"action":"closed","issue":{"url":"https://api.github.com/repos/jamesdbloom/mockserver/issues/614","repository_url":"https://api.github.com/repos/jamesdbloom/mockserver","labels_url":"https://api.github.com/repos/jamesdbloom/mockserver/issues/614/labels{/name}","comments_url":"https://api.github.com/repos/jamesdbloom/mockserver/issues/614/comments","events_url":"https://api.github.com/repos/jamesdbloom/mockserver/issues/614/events","html_url":"https://github.com/jamesdbloom/mockserver/issues/614","id":432033189,"node_id":"MDU6SXNzdWU0MzIwMzMxODk=","number":614,"title":"Add new configuration property for request queue","user":{"login":"nycjoker","id":10779047,"node_id":"MDQ6VXNlcjEwNzc5MDQ3","avatar_url":"https://avatars2.githubusercontent.com/u/10779047?v=4","gravatar_id":"","url":"https://api.github.com/users/nycjoker","html_url":"https://github.com/nycjoker","followers_url":"https://api.github.com/users/nycjoker/followers","following_url":"https://api.github.com/users/nycjoker/following{/other_user}","gists_url":"https://api.github.com/users/nycjoker/gists{/gist_id}","starred_url":"https://api.github.com/users/nycjoker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nycjoker/subscriptions","organizations_url":"https://api.github.com/users/nycjoker/orgs","repos_url":"https://api.github.com/users/nycjoker/repos","events_url":"https://api.github.com/users/nycjoker/events{/privacy}","received_events_url":"https://api.github.com/users/nycjoker/received_events","type":"User","site_admin":false},"labels":[{"id":29788025,"node_id":"MDU6TGFiZWwyOTc4ODAyNQ==","url":"https://api.github.com/repos/jamesdbloom/mockserver/labels/enhancement","name":"enhancement","color":"84b6eb","default":true},{"id":1673031249,"node_id":"MDU6TGFiZWwxNjczMDMxMjQ5","url":"https://api.github.com/repos/jamesdbloom/mockserver/labels/next","name":"next","color":"fef2c0","default":false}],"state":"closed","locked":false,"assignee":{"login":"jamesdbloom","id":733179,"node_id":"MDQ6VXNlcjczMzE3OQ==","avatar_url":"https://avatars1.githubusercontent.com/u/733179?v=4","gravatar_id":"","url":"https://api.github.com/users/jamesdbloom","html_url":"https://github.com/jamesdbloom","followers_url":"https://api.github.com/users/jamesdbloom/followers","following_url":"https://api.github.com/users/jamesdbloom/following{/other_user}","gists_url":"https://api.github.com/users/jamesdbloom/gists{/gist_id}","starred_url":"https://api.github.com/users/jamesdbloom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamesdbloom/subscriptions","organizations_url":"https://api.github.com/users/jamesdbloom/orgs","repos_url":"https://api.github.com/users/jamesdbloom/repos","events_url":"https://api.github.com/users/jamesdbloom/events{/privacy}","received_events_url":"https://api.github.com/users/jamesdbloom/received_events","type":"User","site_admin":false},"assignees":[{"login":"jamesdbloom","id":733179,"node_id":"MDQ6VXNlcjczMzE3OQ==","avatar_url":"https://avatars1.githubusercontent.com/u/733179?v=4","gravatar_id":"","url":"https://api.github.com/users/jamesdbloom","html_url":"https://github.com/jamesdbloom","followers_url":"https://api.github.com/users/jamesdbloom/followers","following_url":"https://api.github.com/users/jamesdbloom/following{/other_user}","gists_url":"https://api.github.com/users/jamesdbloom/gists{/gist_id}","starred_url":"https://api.github.com/users/jamesdbloom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamesdbloom/subscriptions","organizations_url":"https://api.github.com/users/jamesdbloom/orgs","repos_url":"https://api.github.com/users/jamesdbloom/repos","events_url":"https://api.github.com/users/jamesdbloom/events{/privacy}","received_events_url":"https://api.github.com/users/jamesdbloom/received_events","type":"User","site_admin":false}],"milestone":null,"comments":4,"created_at":"2019-04-11T13:46:48Z","updated_at":"2019-11-16T14:16:14Z","closed_at":"2019-11-16T14:16:14Z","author_association":"NONE","body":"MockServer currently supports a property `maxExpectations`. \r\n\r\nIt seems this setting is used in 2 places:\r\n\r\n1. The maximum active expectation to hold in memory. If the project initialize expectations then they will be added to a queue of the defined maximum size.\r\n\r\n2. The request log queue which captures logs, requests, and recorded expectations. This queue is defined with size of `maxExpectations * 2`.\r\n\r\nIt would be great if a new property can be defined specifically for use case 2. Here is why:\r\n\r\n- In my project I have ~500 active expectations that are registered at startup with `maxExpectations` set to 500. During initialization memory space is taken up as these expectation are registered.\r\n\r\n- As the MockServer proxy runs and forwards all requests that do not have matching expectations it automatically captures it in memory for record/replay purposes. The size of this queue in my case is a 1000 (500 * 2). \r\n\r\n- In this case, there are a total of 1500 objects in memory.\r\n\r\n- If anyone uses the REST API to retrieve recorded expectations or requests the code traverses the request log queue (size 1000) and adds matching requests to an ArrayList. As items are added to the ArrayList memory space temporarily grows. Worst case, in a single thread, you will fetch all 1000 recorded expectations. Although GC will clean up the objects the memory usage will become very high. In a multi-threaded operation of hitting REST API to fetch recordings it will be even higher.\r\n\r\n- If a new property is introduced to set the maximum size of the request log queue then behavior can be controlled. For example, if the request log queue max size is set to 0 then nothing will be held in memory for recordings. Yet, the active expectations queue (ones registered at startup) would not be impacted.\r\n\r\nWould it be possible to add the new property?\r\n"}}
{"actor":{"display_login":"jamesdbloom"}}