1

This is not a topic I know that much about (hence this question) so the title and anything else might be bit off, feel free to edit. or suggest changes.

I'm not even sure if this is the correct stack exchange site for this type of question, but it's my best guess (if you think another would be better suited please drop a comment).


type annotations are to help clarify; [T;n] is an array of T values of length n

I want to cache data server-side between client interactions.

I have a web application which has a sequence of AJAX calls following:

  1. A user upload a greyscale image ([uint;n]).
  2. The application converts this image to a binary image (255 or 0,[bool;n]) and then finds the bounds around non-contiguous areas of black ([(uint,uint);m]), then returns these bounds.
  3. The user judges whether these bounds are accurate, with client-side returning [bool;m]

Between 2. and 3. the server is using user feedback to filter [(uint,uint);m]. To do this I can see 2 ways:

Approach 1: The servers sends the [(uint,uint);m] to the client which then sends a modified [(uint,uint);m] back.

Approach 2: The server caches and then sends[(uint,uint);m] to the client which then sends[bool;m] back.

Approach 2 is desirable as this is far less data being sent to the server, 128 times less data (1*m Vs 2*64*m, when m=100, 13 bytes Vs 1600 bytes).


I need some fast way to cache these values between client interactions, a list where bounds can be pushed and pulled from quickly (like a queue)(and where items push with a timestamp and get deleted after a time limit).

My issues arise when thinking that in deployment client calls may be sent to different instances running on different cores or possibly even different systems.

Using a list wouldn't work across cores, using an in-memory data store (like redis) I think wouldn't work across systems.

Is there a good approach to this problem or should I simply go with approach 1?

5
  • What does [(uint,uint;m)] mean (at step 2) according to your type annotations? Did you mean [(uint,uint);m]?
    – gthanop
    Jul 16, 2021 at 8:57
  • Yes, just updated. Jul 16, 2021 at 12:35
  • 1
    This sounds a lot more tapprpriate on stackeoverflow. I think this is much more a programming question than an administrative one.
    – TomTom
    Jul 16, 2021 at 12:44
  • 1
    This question should be asked on Software Engineering. Jul 16, 2021 at 13:14
  • There is also a related question there...
    – gthanop
    Jul 16, 2021 at 13:17

0

You must log in to answer this question.

Browse other questions tagged .