0

There is one website written in CakePhp and I am moving to Django. Some pages are making get/post request to another website to collect some information.

CakePhp

$start = time();
$socket = new HttpSocket();
$api_ret = $socket->get($url,$data,$this->header);
$end = time();
CakeLog::write('Time', print_r($end-$start,true));

Django

import requests
from datetime import datetime
start = datetime.now()
api_ret = requests.get(url,data,headers=self.header)
end = datetime.now()
print((end-start).total_seconds())

Time taken by requests is too long compare to CakePhp.

Is there anything I am doing wrong or Is there any other library that I can use ? Please Help.

Anonymous
  • 77
  • 8
  • Can you be more specific? There's no processing here, so your bottleneck is almost certainly the network transfer. – Tim Roberts Nov 24 '22 at 04:08
  • CakePhp is currently in production (Apache server) and Django is at my localhost. I am testing both from same computer. Is this may be the reason? – Anonymous Nov 24 '22 at 04:17
  • Do you mean that CakePhp is making a request to itself? That would be much faster than a request which goes across a network. – Nick ODell Nov 24 '22 at 04:25
  • No, They are making request to a external website. – Anonymous Nov 24 '22 at 04:29
  • But remember that, with Apache, there is a long-running PHP interpreter. It doesn't have to load. The Python interpreter has to start a process and load.. – Tim Roberts Nov 24 '22 at 05:53

0 Answers0