Why do two ashx, requests always return together when the slowest ashx completes?

ASP.NET project, two classes An and B are implemented since IHttpHandler,A normally takes 3 seconds, and B takes 3 seconds. On the client side, two threads are used to request An and B respectively. Through fiddler packet grab observation, the request time is almost Synchronize. In theory, AB should not interfere with each other. Whoever finishes it first will return soon, that is, B will return soon, and A will return after about 3 seconds, but almost all of them will return together after 3 seconds. It seems that B is waiting for A. It is rare for B to return first, but whether simultaneous or successive, An and B are not executed on the same thread (confirmed by writing thread id to the response header). Why? How to keep them from waiting?


I think I know that AB also implements IRequiresSessionState, without blocking the interface. It seems that Session has an impact on concurrency, so you should use it with caution.


Session implements read-write locks in

asp.net.
your problem is that write locks are implemented in a.aspx, blocking access to session for b.aspx pages.
if you want to access it at the same time, set the a.aspx as follows
<% @ Page EnableSessionState= "ReadOnly"% >, as well as in b.aspx, because read locks can block write locks.
now b.aspx can be accessed normally.
similarly, if you want to customize the implementation of IHttpHandler, you need to implement IRequiresSessionState and IReadOnlySessionState two tag interfaces.
from MSDN
https://social.msdn.microsoft.


//
//CPU
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;

namespace 
{
    /// <summary>
    /// :
    /// 1.BeginEnvoke EndEnvoke
    /// BeginInvokeEndInvoke
    /// </summary>
    class Program
    {
        public delegate void PrintDelegate(string s);
        static void Main(string[] args)
        {
            PrintDelegate printDelegate = Print;
            Console.WriteLine("");

            IAsyncResult result= printDelegate.BeginInvoke("Hello World.", null, null);
            Console.WriteLine("...");
            //BeginInvokeEndInvoke
            printDelegate.EndInvoke(result);

            Console.WriteLine("Press any key to continue...");
            Console.ReadKey(true);
        }

        public static void Print(string s)
        {
            Console.WriteLine(":"+s);
            Thread.Sleep(5000);
        }
    }
}

" more. "

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e91c4c-4715c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e91c4c-4715c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?