MySQL shutdown (also counted as a kind of destruction) is the connection,
GD destroys the canvas.
MySQL connection is a process, what is GD's drawing? Memory?
Why is the canvas particularly resource-intensive? What part of the resource is consumed? Cpu? Memory? Or the other?
I want to know a friend to give a little instruction thank you
Reply content:
MySQL shutdown (also counted as a kind of destruction) is the connection,
GD destroys the canvas.
MySQL connection is a process, what is GD's drawing? Memory?
Why is the canvas particularly resource-intensive? What part of the resource is consumed? Cpu? Memory? Or the other?
I want to know a friend to give a little instruction thank you
1.MySQL connection is a thread, not a process
The client initiates a connection to the MySQL server,mysql server listener process, listens to the new request, and then MySQL assigns it a new thread to process the request. From the beginning of the connection, the CPU will give it a certain thread stack, then authenticate the user, establish the context information, the final request is completed, close the connection, and release the resources, in the case of high concurrency, the system would bring enormous pressure, can not guarantee performance. So, MySQL through the thread cache is to implement thread reuse, reduce this part of the consumption, a connection disconnected, does not destroy the thread that hosts it, but put this thread into the thread buffer, and in a suspended state, the next time a new connection arrives, First go to the thread buffer to find out if there are idle threads, if any, then use it, and if not, create a new thread.
2.GD release, is free memory
After the image is output, the contents of the canvas are no longer useful. For the sake of saving system resources, it is necessary to clear all the memory resources occupied by the canvas in time.
Simply put, the resources GD consumes have at least memory.
You know, the image relative to the text, the stored information is massive, very cost memory.
When you start using GD, you allocate a lot of memory to the canvas.
When you are finished, this part of the memory is useless, of course, to release.
As for the specific GD will use what resources, this and GD implementation related.
Like file open/close, database connection/disconnect, memory request/release and so on, after the use of resources, develop a good habit of release.