I am calling a MYSQL function from the PHP controller in Codeigniter. When I execute the controller function through browser by mentioning the URL all works fine and memory consumption is not significant.
BUT when I use the same link in a cronjob it consumes so much memory. Effectively it consumes 99% of the 4GB server memory within 2-3 hours when executing cron every 4 minutes.
Could you please advise a solution for this.
答案 0 :(得分:-1)
我感觉到的问题不是MySQL查询,而是整个查询执行一个完整周期。您已将时间设置为每4分钟一次,所以我认为4分钟后,以前的进程存在并且一个新进程正在启动,最终有这么多进程正在运行,这正在消耗服务器内存。请增加时间间隔并进行测试。