@
@
@antoo2013-06-15 21:18:06
PHP
@antoo, 2013-06-15 21:18:06

Find out where the delay occurs

Hello.
There is a highly loaded server. Powered by PHP + MySQL + Apache (backend) + nginx (frontend).
The problem is this: any, the simplest PHP script, runs for about 5 seconds.
Script example:

  $query = mysql_query("select `banned` from users where `user_id`='$id' LIMIT 1");
  $data = mysql_fetch_assoc($query);
  if($data['banned'] === '1')
  {
    echo 'Your account has been suspended.';
    exit;
  }


At first I sinned on the database, I tried to execute the request directly in phpMyAdmin (which, by the way, is also very slow): Displays rows 0 - 0 (1 in total, the request took 0.0001 seconds), it is clear that the problem is not in the long query.

Tell me, please, how to see at which stage the delay occurs? Thanks in advance.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Egor, 2013-06-15
@ese

There can be many reasons to explicitly install it, study the statistics and logs on the servers. First of all, see if you hit the allocated channel bandwidth :) Analyze the output of the SHOW STATUS query in MySQL, look at the loading of the screws.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question