Tham khảo tài liệu 'design and implementation guidelines for web clients- p2', công nghệ thông tin, quản trị web phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | and Asynchronous Programming in Web Applications In This Chapter This chapter describes how to use two closely related mechanisms to enable you to design scaleable and responsive presentation layers for Web applications. The two mechanisms are Multithreading Asynchronous programming Performance and responsiveness are important factors in the success of your application. Users quickly tire of using even the most functional application if it is unresponsive or regularly appears to freeze when the user initiates an action. Even though it may be a back-end process or external service causing these problems it is the user interface where the problems become evident. Multithreading and asynchronous programming techniques enable you to overcome these difficulties. The Microsoft .NET Framework class library makes these mechanisms easily accessible but they are still inherently complex and you must design your application with a full understanding of the benefits and consequences that these mechanisms bring. In particular you must keep in mind the following points as you decide whether to use one of these threading techniques in your application More threads does not necessarily mean a faster application. In fact the use of too many threads has an adverse effect on the performance of your application. For more information see Using the Thread Pool later in this chapter. Each time you create a thread the system consumes memory to hold context information for the thread. Therefore the number of threads that you can create is limited by the amount of memory available. 116 Design and Implementation Guidelines for Web Clients Implementation of threading techniques without sufficient design is likely to lead to overly complex code that is difficult to scale and extend. You must be aware of what could happen when you destroy threads in your application and make sure you handle these possible outcomes accordingly. Threading-related bugs are generally intermittent and .