With regard to the concurrency of express, nodejs is single-threaded, with 1000 requests. Does the next request have to wait for the previous processing before it can be executed?

this is the server code

app.get("/test", (req, res, next) => {
    res.json("test")
})

frontend code, 1000 requests

<Menu.Item key="abc">
    <a onClick={() => {
        for (let i = 0; i < 1000; iPP) {
            fetch("http://localhost:3001/test")
                .then((res) => {
                    return res.json()
                })
                .then((data) => {
                    console.log(data);
                })                              
        }
        
    }}>abc</a>
</Menu.Item>

this is the usage time of browser requests, and it all increases gradually. In the end, it has been more than 2 seconds. Why can we still say that nodejs is high concurrency, or that the back-end code I wrote is wrong, or that we have to do extra operations to achieve high concurrency? ask God to solve the puzzle

.

clipboard.png

clipboard.png

Mar.14,2021

all your requests are sent in turn, and you do not achieve concurrency . You can use ab tool


to test concurrency.

1000 1000 . It's all caching. The
gray bar represents stalled , the green bar represents waiting (that is, the response), and the blue bar represents Content Download .

how to use the Timeline tool

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-1b36f98-2c03f.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-1b36f98-2c03f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?