Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am using a HTTP handler to raise a file download.Basically code in the 'ProcessRequest' retrieves data from the database,creates a temporary copy of the existing template spreadsheet with a GUID as its name and writes data retrieved from the DB into it cell by cell using COM,raises a file download and deletes the temporary spreadsheet created.This whole process usually takes around 4-5 mins.But when we tried to concurrently test this process it took around 15 mins.

I am wondering if setting 'IsReusable' boolean to true could help improving the performance.But I am not sure,if it is safe.

Could someone please help me with it?

**Update:**Because I am using a different filename for each of the temporary files created I am assuming that there wont be safety issues.But still not sure.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
191 views
Welcome To Ask or Share your Answers For Others

1 Answer

The IsReusable property will do just what you think it does. Instead of constructing a brand new Handler to be used each time a request is made, it will reuse the existing one. If you have instance variables that are created in the constructor it could boost performance, but only if they are expensive to create.

Also, if you are maintaining any kind of state in the handler, then whatever state you leave it in will be there for the next request. This could have unintended side effects.

If the bulk of your process happens in the ProcessRequest method, then your bottle-neck is there, and you should use profiling to see where you can speed up performance.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...