Does Azure front door actively replicate its cache? - azure-front-door

Does the AFD cache push / replicate out to additional POP's, once an initial request to a single POP has completed? I cant find any documentation on the AFD documentation in relation to this.
Ultimately what I want to know is:
If an initial request occurs from EU, served by the EU POP (after pull though from origin server); then 1h later an identical request occurs from the US, is this request a 'cache hit' in the US POP, or a miss with a read through?

The first request by the any POP will not be cached. As per your example, the request sent form US will be a MISS and any subsequent request will be cached in that POP server.

We were seeing mixed behaviour on our systems, and the below extract explains how AFD functions, and why we got the mixed behaviour.
Lets say out of out of 100 POPs globally, we have 20 super POPs. The remaining 80 will
never reach the API backend directly but will only go to super POPs.
And then the Super POPs go to your API to pull the content. There on
not just the initial POP but also the super POP now have the cached
content. Across the globe the Super POPs keep getting warmed up with
the cache content. Each Edge POP has a mapping to a Super POP. This
overall helps improve cache hit ration significantly and also
significantly reduces the load on your application backends.

Related

Alamofire global queue with pause between requests

I'm working with an API which only permits a maximum of 5 requests per second. If this limit is exceeded the API returns a 429 server error.
My intuition says that to handle this, I should put all requests into some form of serial queue, and enforce a delay of 0.21s between requests, but I'm not quite sure how to accomplish this. I'm also not sure if using a serial queue is a good idea, as then I'll lose the ability to have multiple requests running at the same time.
I am using adapter and retrier objects to handle refreshing my OAuth session token, so I guess this may be a good place to put my logic.
Has anyone done something like this before, or have any ideas?
Actually I'd probably go a different direction, rather than trying to throttle all requests, I'd look at the response from each request and if it's a 429, I'd re-queue the request via an async closure with a 1 second time delay.
This means that as long as requests are coming in slowly they are executed immediately. But when you try the 6th request, it's shifted into the next second.
The only problem you're going to have to consider (regardless of solution) is what happens if requests keep coming in faster than the API will allow. ie. what happens if you get 6, or 7 or 100 requests per second, for every second? How are you going to deal with the extra requests that will never get executed.
At some point your code is going to have to start failing requests. Alternatively you need to push the server people to run up more servers or give you more bandwidth.

When do I make an API call

I am currently using VIP architecture and I was wondering when I should make an API call.
For example, I have two views. A connection view leading to a list view.
The list needs the user to connect to load.
My question is, where should I make my API call to fetch data for the second view ?
Should I make the request as soon as the connection succeeds, and then launch the 2nd view once I get the data of this request.
Or
Should I launch the 2nd view first and then make the request for this view ?
The first solution seems slightly faster, but the second one feels cleaner.
What do you think ?
First of all, VIP/MVC/MVVM architecture has nothing to do with your issue, none of there architectures has rules about when you need to make API calls.
Everything depends on your needs and tech requirements.
As for me there is two most important points:
if your second screen is data sensitive and you need to be sure, that it display latest data - make API call after this screen was displayed and update it UI with latest data.
if you don't care if data that you display is latest/ or you this data would not be updated very often/ or you show static data that would be rarely changed, BUT for you is important that user will see next screen immediately - make API call as soon as it possible(preferably on app launch)
If both previous points is not important for you - make API call after screen will be displayed. It will guaranty that you has latest data.
But you need to remember that there is no rule about it, so make API calls when you really need it.

Eclipse Scout Neon Message box triggered on server side

I am wondering if there is a way to trigger message box on server side.
My case is that I have some logic on server side of the scout application. In the middle of the process some decision need to be made. It this case I would like to trigger message box with YES, NO, CANCEL options.
The way my logic works it really hard to split it into two functions and call one first, ask question and call another with on answer. So this is out of the way for me.
If it is not possible to triggered message box on scout service, is there a way to "mimic" it. So call service method, in the middle pause it, go to client side, present messsage box, return to same service method and continue it.
Why do I need this:
I have dependencies graph (between fields) implemented on scout server side.
After one field has been changed, the whole dependencies graph will be resolved.
One node of the graph has some logic that need user interaction. Problem is that I don't know if this method will be called (dependent on a graph), and if after this method other nods will be called.
You have asked a very similar question few months ago:
Scout Eclipse present optional message on server side
MessageBox is a client concept (package is: org.eclipse.scout.rt.client.ui.messagebox).
You need to transfert the data you need from the server to the client and intercept this information client-side to display the message box you want.
As Jmini already said, MessageBox is a client concept. What you can do is sending back a status (from server to client), checking it on client side and show an appropriate message (box). But then you interrupt your service method and cannot go on where it stopped (alternatively you can throw a VetoException, but this interrupts your service method aswell, so same problem). In my opinion, it is also not a good design to 'request' a user interaction from server side, because in this case, the server side has to wait for the user to respond.
I suggest, if possible, to split your logic into different parts. At first, you execute the first part until you reach the point where you need the user interaction. Then you could save the current state of execution, return to client and show the message. After the user has responded, you should start the 'second' execution, depending on the user's input. This second execution should be started by calling another (new) service, which at first should load or restore the state of the execution saved before requesting the user input.

How to stop runaway processes

So I'm working on this application that requests and retrieves webservice content for iPhone. The problem I am running into is this: When I initially request data, it is spawned off as an independent thread so that the application does not become unresponsive due to the network being slow. What this means is that if the user navigates away from the current page before this data finishes downloading, unexpected things can happen.
I have managed to narrow down the problem cases to one relatively simple one: I have some nested tables, so if a user goes down into the "Messages" table, which can sometimes take a little while to download, then back out immediately, and select a different set of messages to view, the previous set of messages ends up loading, because it was still in the queue.
Here are things I have tried:
1) I tried cancelling the operations, but this is futile, because since I only allow one operation in the queue at the time, it triggers immediately
2) I tried validating that the recipient of the data is the same, but this doesn't work because the actual table object is the between the two selections, it just needs a different data set.
Anyone have any general programming suggestions on how to solve this tricky threading problem?
On an iPhone specific note: if I could just stop the user from being able to back out of the messages table, I wouldn't have this problem, because they would basically be locked into that view until the data has finished loading.
Thanks!
This post has some design advice relating to iOS networking and threading. The basic gist of it is "Don't use explicit threading", and I couldn't agree more. NSURLConnection has great built-in functionality for asynchronously loading data from a URL while managing all of the threading for you. They can also be cancelled easily at will.
If you were to use the NSURLConnection paradigm, you can simply cancel any pending request when you back out of the requesting view controller.

How does the Notice Area on Facebook works?

How does the notification area on Facebook works?
I'm taking about the automatically red box that appears.
If I have a message/something new on my wall.
I believe it is also in Stack Exchange, is that a Javascript interval?
Please see this thread
How does one do realtime updates of a web page?
Not sure about this, but I'd wager that both Facebook and SO use an implementation of Comet. Basically, you make a request to the server which is designed to be kept open a really long time, and the server only responds when it has something to say. When the request times out (or receives data back) you simply start up another one. This way you get as close to real-time data as you can without wasting a ton of bandwidth on empty requests.