Using cfhttp in multiple files taking too much time

I don't know if this is possible, but I just want to ask if we can cfhttp or any other thing to read the selected amount of data instead of putting the whole file in CFHTTP.FileContent.

I use cfhttp and want to read only the last two lines from remote xml files (about 20 of them) and read the middle two lines from some text files (about 7 of them). Is there a way that I could just read this specific data instead of getting all the files, because it takes a lot of time right now (about 15-20 seconds). I just want to reduce the runtime of my .cfm page. Any suggestions???

+3
source share
3 answers

Hmm, not a very special way to get only parts of deleted files.

Do you need to do this every time? Could you get the files in the background, write them locally, and so that your actual incoming requests just read these files? Make reading remote files asynchronous for incoming requests?

If not, and you are using CF8 +, you can use CFTHREAD to deploy various queries for parallel operation: http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_t_04.html

In the end, you can use the "join" action to wait for all threads to complete.

Edit:

Here's a great Ben Nadel tutorial on using CFThread to parallelize CFHTTP requests:

http://www.bennadel.com/blog/749-Learning-ColdFusion-8-CFThread-Part-II-Parallel-Threads.htm

- :

27-30 HTTP- 20-30 . 1-2 , .

+5

HTTP . ColdFusion.

, CFHTTP = "HEAD" , .

?

  • , CFHTTP = "GET",
  • , CFHTTP = "HEAD" , . , , CFHTTP method = "GET", .

method = "HEAD" http, , . , 30 , , .

+3

CF , URL?

XML, , xmlSearch() ?

, u numOfLines ?

0

Source: https://habr.com/ru/post/1743049/


All Articles