exciter Posted March 17, 2020 Posted March 17, 2020 Hello, for highcharts I fetch my data with a php script (json) from a mysql table.When I try to build the chart with all records of the database, I get the following messsage in the error log: Allowed memory size of 134217728 bytes exhausted (tried to allocate 24657951 bytes) Please raise the memory limit for my account (exciter), so I can use the script and the data of my table.I will run the script 2-3 times per day, after setting up everything Thanks!
wolstech Posted March 17, 2020 Posted March 17, 2020 I'll pass this to Krydos, but I have a feeling that this limit cannot be increased any further. 128MB is already a lot of memory for one script. If you need more than 128MB of memory, the script is too heavy to be run here. It sounds like you're either using poorly written code, or you've outgrown our service.
exciter Posted March 17, 2020 Author Posted March 17, 2020 I'm new to php, so maybe it's not perfect Maybe someone here is able to optimize it...
exciter Posted March 17, 2020 Author Posted March 17, 2020 In another forum they told me to decrease "precision" or "serialize_precision" settings down to 14.But I guess, only an admin is able to do that...
Krydos Posted March 22, 2020 Posted March 22, 2020 The memory limit on Tommy's php 7.3 is already 128 MB which is the maximum we're going to be able to do for now. We are currently experiencing a lot of load spikes on Tommy that are primarily caused by high memory usage by php. If you need more than 128 MB I would recommend a vps https://www.heliohost.org/vps/ where you'll have root access to set the memory limits to whatever you want. Another option would be switching to the Johnny server where uptime doesn't matter as much. We try to keep Tommy consistently in the 99%+ uptime range, while Johnny is currently about 85% uptime over the last week.
exciter Posted April 3, 2020 Author Posted April 3, 2020 (edited) I got the info, that it maybe depends on the precision in the php.ini.Tested on another server: ini_set('precision', 40);$value = 29.915;echo json_encode($value);-> 29.91699999999999914734871708787977695465 That's what I get on Tommy too. And with:ini_set('precision', 14);$value = 29.915;echo json_encode($value);-> 29.917 How can I decrease the php precision to 14? Edited April 3, 2020 by exciter
Krydos Posted April 4, 2020 Posted April 4, 2020 Try the number_format function: number_format((float) $number, $precision, '.', '');
Recommended Posts