Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
192 views
in Technique[技术] by (71.8m points)

asp.net - Setting HTTPHandler isreusable property

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

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

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...