via mqtt. Each device sends 200 records per second. My program needs to add the mTS and device ID to each record and append it to a file. Once it reach 24000 records it has to close the file and launch an mqtt message which is collected by another program which zips, sends and deletes. PHP can handle about 20 devices, I wanted to know if I can go further with fpc. Can you advise me?
I cannot give specific advice, as I have not come across this protocol. But I can give a general advice... FPC will be faster and more agile than PHP, without a doubt, if you write the code correctly. The fact is that compiled languages are more sensitive to flaws in the design of the application architecture. But in general, there is no doubt that the compiled language will be a priori faster than the interpreted one. Exceptions usually apply to cases where they try to make a copy of the functionality from PHP to Pascal, although there, as a rule, the approach should be slightly different
Your story would be different if you has db and API at your own. 5ms rate is not a problem i think.
Why dont you store the 24000 records in memory and then write to file once this number is reached? It dont looks like lots of memory and memory is thousands of times faster than disk.
You're great. I'll try.
the db is not applicable. Nothing can be more efficient than random file
I would have thought the same thing if I hadn't tried. The truth is perhaps in the fact that php8 uses a Jit compiler which is very efficient
??? I dont think so, i got API for collecting many sensors data.
5ms is the interval of only one device. Today I connected 4, on Monday there will be 8 and we will probably reach 20. Let's talk about microseconds.
My solution also modular, if you host on sbc, 1000 collector device are not a problem.
PHP uses a lot of tricks to be faster
Обсуждают сегодня