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

Limit cache size by default #65

Closed
kelunik opened this issue Sep 12, 2017 · 6 comments
Closed

Limit cache size by default #65

kelunik opened this issue Sep 12, 2017 · 6 comments

Comments

@kelunik
Copy link
Member

kelunik commented Sep 12, 2017

See amphp/cache#4.

@kelunik
Copy link
Member Author

kelunik commented Oct 4, 2017

The linked issue has been implemented, what's a good default cache size?

@kelunik
Copy link
Member Author

kelunik commented Nov 7, 2017

@amphp/dns Any suggestions?

@bwoebi
Copy link
Member

bwoebi commented Nov 7, 2017

Don't really know.
I think a LRU cache with size=256 should be really sufficient for most needs. That's not too large, but really not less than 99% of use cases will need.

@Danack
Copy link
Contributor

Danack commented Nov 7, 2017

If it's a LRU cache, it should be way bigger than 256. Memory is pretty cheap and the entries are pretty small, right?

Is there any problem with having a 64kB entry cache?

@bwoebi
Copy link
Member

bwoebi commented Nov 7, 2017

I meant 256 entries ;-), which, in PHP, will be around 80 KB, I guess. (if using an array as fundamental structure … an object could optimize it a bit, down to probably 30 KB)

@kelunik
Copy link
Member Author

kelunik commented Nov 7, 2017

Yes, it's LRU as implemented in amphp/cache#5. Entries should be pretty small. Keep in mind that one lookup usually creates two entires, one for A and one for AAAA.

I guess something like 4096 entries should be totally enough? But most applications probably need way less, because they either query the same domains over and over or query random domains.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants