NetTalk Central

Author Topic: Web Services and large reports  (Read 2731 times)

astahl

  • Sr. Member
  • ****
  • Posts: 308
    • View Profile
    • Email
Web Services and large reports
« on: October 23, 2017, 05:31:06 AM »
Hi All,

I have a report exe that is called by a NT Web Services app. These reports can be quite large, 5000 pages plus in a pdf. Currently the web service goes into a loop until the pdf is available, this is fine for small reports. I am worried when a large report needs to be generated the server will time out.

Questions:
1.) Will the web service time out before the report is completed?
2.) Should I create a webservice that fetches the file once completed?


Ashley

bshields

  • Sr. Member
  • ****
  • Posts: 392
    • View Profile
    • Inhabit
    • Email
Re: Web Services and large reports
« Reply #1 on: October 23, 2017, 06:48:23 PM »
Hi Ashley,

The web server isn't likely to timeout, the thread runs for as long as necessary, but the client using your web service is very likely to get bored and wander off.

You could either:

1. Continue as is, and tell the client the response can take a very long time, and its their responsibility to hang around for the result

or

2. Accept the request for the report and then have another end point they can poll, and once the report is available it will be served by that end point (but this is pretty crappy, as the poll can cause unnecessary load on your end and theirs - but often the only solution in some circumstances)

or

3. Ask them for a "WebHook" which is like a callback and once you have produced the report you can POST it to their nominated end point. This only works if your client is a web server style system not behind a firewall etc (this is arguably best practice).

or

4. Email them the report (pragmatic and simple, but implies the end user is a human not a server)

or

5. FTP or dropbox etc the report (same as #4).

Regards
Bill Shields

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11182
    • View Profile
Re: Web Services and large reports
« Reply #2 on: October 23, 2017, 09:53:58 PM »
All good options.
I'd likely go for 2 most of the time as this will "just work". In other words you API is in 2 steps;
a) request the report to be generated

b) fetch the report. (if you try every couple mins or so the overhead will be minimal. And you might get back the answer "not ready yet" or "ere it is".

One other option Bill didn't mention - open a web socket connection to the server so it can let you know when the report is ready.

cheers
Bruce

astahl

  • Sr. Member
  • ****
  • Posts: 308
    • View Profile
    • Email
Re: Web Services and large reports
« Reply #3 on: October 24, 2017, 03:02:03 AM »
Bruce and Bill,

I was thinking along the line of Bill's option 2. Bruce, I never thought of the websockets as a way to let them know it was finished.

So I better get cracking and watch your seminar on websockets again Bruce.

Thanks for the info.

Ashley