TeaStore icon indicating copy to clipboard operation
TeaStore copied to clipboard

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

Open hkayabilisim opened this issue 3 years ago • 4 comments

hkayabilisim avatar Jul 19 '21 11:07 hkayabilisim

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.

hkayabilisim avatar Jul 19 '21 11:07 hkayabilisim

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 :)

SimonEismann avatar Jul 19 '21 13:07 SimonEismann

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<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 :)

— 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 .

hkayabilisim avatar Jul 19 '21 19:07 hkayabilisim

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 :)

SimonEismann avatar Jul 21 '21 09:07 SimonEismann