Baris Caglar's Blog

  • Memory management in classic ASP Pages

    Classic ASP has a wonderful feature of disposing of a session when a session is stateless. If the pages a visitor to a website browses to do not alter the session state or request the session ID, then the ASP engine considers this to be a stateless session and reclaims all the resources a session may hold at the end of each request.
     
    Considering each session has some memory overhead, in a busy website the act of allocating a session and keeping the memory for every visitor will have some ramifications. If you get 1000 unique visitors to your website per minute, with the default value of 20 minutes per session, you will be keeping on average 20000 sessions on your server at any given time. If for each session you keep a lot of data... Well you can do the math.

  • My BeginRead never calls my callback function, please help!

    So you have decided to do some awesome async network communication and you have settled about using NetworkStream, in System.Net.Sockets namespace. Perhaps the most important reason to choose NetworkStream over other encapsulations of socket communication is the fact that NetworkStream “is a” Stream and you can use it in any method that expects a Stream and it will work. This way you can write code that reads from or writes data to a System.IO.Stream such as FileStream, NetworkStream, etc. without knowing what kind of stream you will be working with, clairvoyant style.