DescartesResearch / TeaStore

A micro-service reference test application for model extraction, cloud management, energy efficiency, power prediction, single- and multi-tier auto-scaling
https://se.informatik.uni-wuerzburg.de
Apache License 2.0
118 stars 134 forks source link

Is it possible to change the caching type of image provider in the runtime? #197

Open hkayabilisim opened 2 years ago

hkayabilisim commented 2 years ago

I'm using Openshift OKD 4.7 and installed TeaStore without a problem. During a stress test, I want to change the caching type and observe its effect on TeaStore's overall performance.

SimonEismann commented 2 years ago

After a quick look into the image provider code, it seems like this is currently not supported. @NSchmittUniWue Could you take a quick look if I didn't miss anything?

What type of trigger do you need to change the cache type? If e.g., a REST API would work for you, this should be pretty easy to implement. The code to set a new cache mode would look something like this.

storage = ImageProvider.IP.getStorage()
cachePredicate = new CacheAll<StoreImage>();
cache = new MostRecentlyUsed<StoreImage>(storage, cacheSize, cachePredicate);
ImageProvider.IP.setStorage(cache);

Creating the REST endpoint would mean copying and adapting this file:

https://github.com/DescartesResearch/TeaStore/blob/e1eea5ce948bd37a2f4217b7532a8557a4eee0e0/services/tools.descartes.teastore.image/src/main/java/tools/descartes/teastore/image/rest/ImageProviderEndpoint.java

Would this solution work for you? Otherwise we can also setup a quick call to discuss how we can make this work :)

hkayabilisim commented 2 years ago

Thank you for the fast reply. REST API is enough for me. Actually, I'm looking for some tunable parameters in TeaStore so that I can tune them automatically under a dynamically changing load pattern. With browse-type loads, I thought image caching type would affect response times. That's why I opened this issue to see how to change cache type. If there are other tunable parameters, I can use them.

On Mon, Jul 19, 2021 at 4:36 PM SimonEismann @.***> wrote:

After a quick look into the image provider code, it seems like this is currently not supported. @NSchmittUniWue https://github.com/NSchmittUniWue Could you take a quick look if I didn't miss anything?

What type of trigger do you need to change the cache type? If e.g., a REST API would work for you, this should be pretty easy to implement. The code to set a new cache mode would look something like this.

storage = ImageProvider.IP.getStorage() cachePredicate = new CacheAll(); cache = new MostRecentlyUsed(storage, cacheSize, cachePredicate); ImageProvider.IP.setStorage(cache);

Creating the REST endpoint would mean copying and adapting this file:

https://github.com/DescartesResearch/TeaStore/blob/e1eea5ce948bd37a2f4217b7532a8557a4eee0e0/services/tools.descartes.teastore.image/src/main/java/tools/descartes/teastore/image/rest/ImageProviderEndpoint.java

Would this solution work for you? Otherwise we can also setup a quick call to discuss how we can make this work :)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/DescartesResearch/TeaStore/issues/197#issuecomment-882553983, or unsubscribe https://github.com/notifications/unsubscribe-auth/AATGBY3HR3VAMASVGAQRYHLTYQS5ZANCNFSM5ATQ6GUQ .

SimonEismann commented 2 years ago

The other easily configurable parameter would be the algorithm in the recommender, but that would be slightly more complicated as a switch would require retraining I think.

Another option would be to make the number of images that are displayed per product page configurable on the server side instead of the client side.

Let me know if you need any support with implementing this :)