Can a web page be refreshed continuously for approx 2 hours using load runner? - html

how can I refresh a webpage continuously using load runner ?
I am looking for an option with loadrunner and not selenium , js or HTML.

Define, "refresh continuously."
Why do I ask this? The server does not care what is on the other end of the request. It could be a full client. It could be a test tool like LoadRunner. It could be a program written in Python. It could be a command line tool like cUrl. The server has no concept of "refresh" on the client, only responding to a request.
You could put a single page load in a loop with no thinktime between requests. This would violate a core tenet of client-server computing, that a delay exists between requests from a client during which the items returned are being processed by either the silicon or organic computing units on the client front.
lr_start_transaction("foo");
while (lr_get_transaction_duration("foo")<3600)
{
// my request code here
sleep(rand()%9000 + 1001);
}
lr_stop_transaction("foo");
On reporting systems one often observes behavior of polling to see when a report is complete. The delay between these requests is often 5-10 seconds for a refresh of the report request. This is typically handled in LoadRunner code with a looping structure which breaks when the report is actually returned. Inside of the loop it issues the request, checks the result to see if exit is warranted, waits the 5-10 seconds then loops.
You could have a script with one request, loaded in the controller with either zero or some pacing. Schedule it for an hour of execution.
many many ways

Related

How to stop http request from dash_renderer

I am trying a build a realtime monitoring system for high frequency data. To increase the performance, I used the extendData property of dcc.Graph() and websocket. So that, the brouser does not need to send request to get data.
I found that it still not increasing the performance as expected. The reason I found is, from the browser, I see (by inspecting network from browser) after some miliseconds browser is still sendng request and the initiator is the dash_renderer.
This picture is for a vanilla example just to show even for a textbox example the http request goes on and on. And for my real time websocket dashboard the frequency of requests get very high.
My question is:
What dash_renderer do?
why it is sending http request?
And how to stop that?
If you run Dash in Debug mode, it has a feature called Hot Reloading which regularly (every 3 seconds by default) checks for changes to your codebase and updates your running app if it finds any. That check for updated code is what you're seeing in the network inspection.
To turn it off, either don't run in debug mode or explicitly set dev_tools_hot_reload to False like so:
app.run_server(debug=True, dev_tools_hot_reload=False)
Although it is late, After some experience, my realization is dash is not designed to work with websocket. It uses call-backs which actually sends requests to server and in server, the callback function (which is python) send back some result.
These call-backs are designed to send HTTP request to server.
For high speed data, the websocket should be used with extendTrace method of plotly.js in client side.

Hosting an APP to accept requests parameters and return a response back

I have a application hosted on some site say "www.myapp.com" which makes a request to another application(say compute_app) hosted somewhere else by passing few parameters and then the compute_app does some computation and returns the data back to primary app.
Say I need to implement two operations : Addition and Decrement in compute_app.
Addition : This operation would need say 2 numbers and output is 1 number
Decrement : This operation needs only 1 number as input and result is the decremented number by some constant value
Let's assume compute_app is hosted at "www.heroku.com/compute_app"
Now basically I need to pass a string "add/dec" along with 2/1 numbers from "www.myapp.com" to "www.heroku.com/compute_app" which does the computation and the result is returned back to "www.myapp.com"
How should I go about designing this by making USE of GET/POST Requests.
The example that I took here is figurative.
Basically I am in need of doing REST API calls from my "myapp" to a externally hosted app (compute app- which does some data pre-processing) and then it actually makes the REST call to Servers serving LIVE data.
So control flow is like:
myapp(raw data)---->compute_app(pre-processing & make call to REST servers) .
Now Rest Servers------>return JSON response to compute_app(it again does pre-processing) and then--->return data to myapp.
myapp = ChatBot
compute_app= 3rd party app for writing Java/PHP code for preprocessing bcoz the framework doesn't allow me to write any scripting code.

How can I configure Polymer's platinum-sw-* to NOT cache one URL path?

How can I configure Polymer's platinum-sw-cache or platinum-sw-fetch to cache all URL paths except for /_api, which is the URL for Hoodie's API? I've configured a platinum-sw-fetch element to handle the /_api path, then platinum-sw-cache to handle the rest of the paths, as follows:
<platinum-sw-register auto-register
clients-claim
skip-waiting
on-service-worker-installed="displayInstalledToast">
<platinum-sw-import-script href="custom-fetch-handler.js"></platinum-sw-import-script>
<platinum-sw-fetch handler="HoodieAPIFetchHandler"
path="/_api(.*)"></platinum-sw-fetch>
<platinum-sw-cache default-cache-strategy="networkFirst"
precache-file="precache.json"/>
</platinum-sw-cache>
</platinum-sw-register>
custom-fetch-handler.js contains the following. Its intent is simply to return the results of the request the way the browser would if the service worker was not handling the request.
var HoodieAPIFetchHandler = function(request, values, options){
return fetch(request);
}
What doesn't seem to be working correctly is that after user 1 has signed in, then signed out, then user 2 signs in, then in Chrome Dev Tools' Network tab I can see that Hoodie regularly continues to make requests to BOTH users' API endpoints like the following:
http://localhost:3000/_api/?hoodieId=uw9rl3p
http://localhost:3000/_api/?hoodieId=noaothq
Instead, it should be making requests to only ONE of these API endpoints. In the Network tab, each of these URLs appears twice in a row, and in the "Size" column the first request says "(from ServiceWorker)," and the second request states the response size in bytes, in case that's relevant.
The other problem which seems related is that when I sign in as user 2 and submit a form, the app writes to user 1's database on the server side. This makes me think the problem is due to the app not being able to bypass the cache for the /_api route.
Should I not have used both platinum-sw-cache and platinum-sw-fetch within one platinum-sw-register element, since the docs state they are alternatives to each other?
In general, what you're doing should work, and it's a legitimate approach to take.
If there's an HTTP request made that matches a path defined in <platinum-sw-fetch>, then that custom handler will be used, and the default handler (in this case, the networkFirst implementation) won't run. The HTTP request can only be responded to once, so there's no chance of multiple handlers taking effect.
I ran some local samples and confirmed that my <platinum-sw-fetch> handler was properly intercepting requests. When debugging this locally, it's useful to either add in a console.log() within your custom handler and check for those logs via the chrome://serviceworker-internals Inspect interface, or to use the same interface to set some breakpoints within your handler.
What you're seeing in the Network tab of the controlled page is expected—the service worker's network interactions are logged there, whether they come from your custom HoodieAPIFetchHandler or the default networkFirst handler. The network interactions from the perspective of the controlled page are also logged—they don't always correspond one-to-one with the service worker's activity, so logging both does come in handy at times.
So I would recommend looking deeper into the reason why your application is making multiple requests. It's always tricky thinking about caching personalized resources, and there are several ways that you can get into trouble if you end up caching resources that are personalized for a different user. Take a look at the line of code that's firing off the second /_api/ request and see if it's coming from an cached resource that needs to be cleared when your users log out. <platinum-sw> uses the sw-toolbox library under the hood, and you can make use of its uncache() method directly within your custom handler scripts to perform cache maintenance.

How does google update their google finance graphs?

i'm looking at a stock/index:
http://www.google.com/finance?q=google
I've got firebug open, in firefox and when the price updates on the page, i dont see any GETs or POSTs, just a get maybe 30 to 60 seconds later.
Surely if the page is being updated with a value, wouldnt firebug show this data reaching the page as it happens? Or does firebug collect connections in batches?
Look further back in the GET connection logs to see if there is a connection that was opened but not closed. It's likely that the page is opening an XmlHttpRequest connection to the data server and keeping the connection open indefinitely. This is common for streaming data situations, even when the data stream is fairly low volume. If this is the case, then new data will arrive on the open connection without any new connection activity reported in the log.
There is one request that never finishes responding (or at least not for the time I watched), you can see this in the NET panel, this response periodically outputs more data which is then used to update the application. If you examine the request you will see that it specifies a header Transfer-Encoding: Chunked, which is used for these purposes, see http://en.wikipedia.org/wiki/Chunked_transfer_encoding.

Asynchronous Ajax call in SCORM API

I am creating a javascript API for SCORM 2004 4th Edition. For those who don't know about SCORM, basically it is an API standard that eLearning courses can use to communicate with an LMS (Learning Management System). Now the API has to have the following method:
Initialize(args)
GetValue(key)
SetValue(key, value)
Terminate(args)
Commit(args)
GetDiagnostic(args)
GetErrorString(args)
GetLastError()
Now Initialize has to be called before anything else, and Terminate must the last. GetValue/SetValue can be called anywhere in between there. What I am doing is in the Initialize method I am getting some JSON from a web service and storing that in the API (to be used when using the GetValue/SetValue methods later). The problem I am coming across is that the AJAX call via jQuery is asynchronous, so the Initialize method call could be done before the JSON is loaded. With that being the way it is, a call to GetValue after calling Initialize could cause unexpected issues b/c the JSON that GetValue uses isn't there yet. My question is this: What can I do to ensure that the JSON is loaded before the GetValue/SetValue methods are called? I know the simple answer is to make it synchronous, but that is not advised mostly, and it doesn't seem to want to do that for me. Here is my code regarding that:
function GetJSON(){
var success = false;
$.ajaxSetup({async:false}); //should make it synchronous
$.getJSON("http://www.mydomain.com/webservices/scorm.asmx/SCORMInitialize?
learnerID=34&jsoncallback=?",
function(data){
bind(data);
success = true;
}
);
return success;
}
function bind(data){
this.cmi = eval("(" + data.d + ")");
$.ajaxSetup({async:true}); //should make it asynchronous again
}
Does anyone have any ideas? I would really appreciate it!
You've articulated the problem well. After the SCO calls Initialize, the CMI data needs to be immediately available for the SCO to make subsequent GetValue calls. However, making synchronous AJAX calls isn't advised, if there is a hangup in the request, it can lock up the entire browser until the request returns or times out. The solution is to pre-load all of the required data before the SCO is loaded. In our SCORM Engine implementation, we preload all of the data (CMI and sequencing) when the player is launched and then use a background process to periodically commit dirty data as the learner progresses through the course. It can get a bit tricky to ensure that all data is properly persisted when dealing with the combinations of possible window launching and exit scenarios, but it's certainly possible. You will want to avoid any requests to the server from within a SCORM API call as SCOs will often flood the LMS with big batches of calls. Making server requests within those calls can seriously degrade the learner's experience and place a performance burden on the server.
Mike
The way we approached this problem was to queue the CMI data in the API when the SCO is launched. We first navigate to a launch page that loads the CMI data into the API's queue, and then the laucnch page actually launches the SCO. When the SCO calls intialize, we just move the data into the CMI.