Skip to main content
edited tags
Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284
More info
Source Link
NickO
  • 311
  • 1
  • 11

I have two Drupal7 sites. I am using a service that allows a registered user to login using session authentication.

On the site that performs the call to my remote service I measured the time when I enter the login function and after I got my session id response. It is 6 seconds apart.

When I use the browser to login it works as normal, no delays. Both Drupal7 instances are running on localhost.

I need some pointers as to where to look in order to reduce this latency.

watchdog("LOG", "Login function hit at " . date(DATE_RFC2822));
$resource = 'access/';

$this->options = array(
  'headers' => array(
    'Accept' => 'application/json',
    'Content-Type' => 'application/json',
  ),
  'method' => 'POST',
  'data' => json_encode(array(
    'username' => $this->username,
    'password' => $this->password,
  )),
);

$response = drupal_http_request($this->base_url . $resource . 'user/login', $this->options);
$data = json_decode($response->data);

// Check response code
if ($response->code == 200 && $data != null) {
  $this->options['headers']['Cookie'] = $data->session_name . '=' . $data->sessid;
  watchdog("LOG", "Connected to remote at " . date(DATE_RFC2822));
}

I wrote a basic php login function to run it from outside a Drupal install and the time to login is 5 seconds. Measured the web login and it's instant. I also switched from Services Resource API 1.0 to 1.1 with no improvements.

I have two Drupal7 sites. I am using a service that allows a registered user to login using session authentication.

On the site that performs the call to my remote service I measured the time when I enter the login function and after I got my session id response. It is 6 seconds apart.

When I use the browser to login it works as normal, no delays. Both Drupal7 instances are running on localhost.

I need some pointers as to where to look in order to reduce this latency.

watchdog("LOG", "Login function hit at " . date(DATE_RFC2822));
$resource = 'access/';

$this->options = array(
  'headers' => array(
    'Accept' => 'application/json',
    'Content-Type' => 'application/json',
  ),
  'method' => 'POST',
  'data' => json_encode(array(
    'username' => $this->username,
    'password' => $this->password,
  )),
);

$response = drupal_http_request($this->base_url . $resource . 'user/login', $this->options);
$data = json_decode($response->data);

// Check response code
if ($response->code == 200 && $data != null) {
  $this->options['headers']['Cookie'] = $data->session_name . '=' . $data->sessid;
  watchdog("LOG", "Connected to remote at " . date(DATE_RFC2822));
}

I have two Drupal7 sites. I am using a service that allows a registered user to login using session authentication.

On the site that performs the call to my remote service I measured the time when I enter the login function and after I got my session id response. It is 6 seconds apart.

When I use the browser to login it works as normal, no delays. Both Drupal7 instances are running on localhost.

I need some pointers as to where to look in order to reduce this latency.

watchdog("LOG", "Login function hit at " . date(DATE_RFC2822));
$resource = 'access/';

$this->options = array(
  'headers' => array(
    'Accept' => 'application/json',
    'Content-Type' => 'application/json',
  ),
  'method' => 'POST',
  'data' => json_encode(array(
    'username' => $this->username,
    'password' => $this->password,
  )),
);

$response = drupal_http_request($this->base_url . $resource . 'user/login', $this->options);
$data = json_decode($response->data);

// Check response code
if ($response->code == 200 && $data != null) {
  $this->options['headers']['Cookie'] = $data->session_name . '=' . $data->sessid;
  watchdog("LOG", "Connected to remote at " . date(DATE_RFC2822));
}

I wrote a basic php login function to run it from outside a Drupal install and the time to login is 5 seconds. Measured the web login and it's instant. I also switched from Services Resource API 1.0 to 1.1 with no improvements.

Source Link
NickO
  • 311
  • 1
  • 11

Delay in logging Drupal user through Services

I have two Drupal7 sites. I am using a service that allows a registered user to login using session authentication.

On the site that performs the call to my remote service I measured the time when I enter the login function and after I got my session id response. It is 6 seconds apart.

When I use the browser to login it works as normal, no delays. Both Drupal7 instances are running on localhost.

I need some pointers as to where to look in order to reduce this latency.

watchdog("LOG", "Login function hit at " . date(DATE_RFC2822));
$resource = 'access/';

$this->options = array(
  'headers' => array(
    'Accept' => 'application/json',
    'Content-Type' => 'application/json',
  ),
  'method' => 'POST',
  'data' => json_encode(array(
    'username' => $this->username,
    'password' => $this->password,
  )),
);

$response = drupal_http_request($this->base_url . $resource . 'user/login', $this->options);
$data = json_decode($response->data);

// Check response code
if ($response->code == 200 && $data != null) {
  $this->options['headers']['Cookie'] = $data->session_name . '=' . $data->sessid;
  watchdog("LOG", "Connected to remote at " . date(DATE_RFC2822));
}