169 похожих чатов

My critical mission is to read messages from peripheral devices

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?

10 ответов

56 просмотров

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.

Gaetano-Di Stefano Автор вопроса
Gaetano-Di Stefano Автор вопроса
Ismail
Your story would be different if you has db and AP...

the db is not applicable. Nothing can be more efficient than random file

Gaetano-Di Stefano Автор вопроса
Renat Suleymanov
I cannot give specific advice, as I have not come ...

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

Gaetano Di Stefano
the db is not applicable. Nothing can be more effi...

??? I dont think so, i got API for collecting many sensors data.

Gaetano-Di Stefano Автор вопроса
Ismail
Your story would be different if you has db and AP...

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.

Gaetano Di Stefano
5ms is the interval of only one device. Today I co...

My solution also modular, if you host on sbc, 1000 collector device are not a problem.

Похожие вопросы

Обсуждают сегодня

30500 за редактор? )
Владимир
47
Недавно Google Project Zero нашёл багу в SQLite с помощью LLM, о чём достаточно было шумно в определённых интернетах, которые сопровождались рассказами, что скоро всех "ибешни...
Alex Sherbakov
5
вы делали что-то подобное и как? может есть либы готовые? увидел картинку нокода, где всё линиями соединено и стало интересно попробовать то же в ddl на lua сделать. решил с ч...
Victor
8
Подскажите пожалуйста, как в CustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean); получить наз...
A Z
7
Ребят в СИ можно реализовать ООП?
Николай
33
https://github.com/erlang/otp/blob/OTP-27.1/lib/kernel/src/logger_h_common.erl#L174 https://github.com/erlang/otp/blob/OTP-27.1/lib/kernel/src/logger_olp.erl#L76 15 лет назад...
Maksim Lapshin
20
Как передать управляющий символ в открытую через CreateProcess консоль? Собсна, есть процедура: procedure TRedirectThread.WriteData(Data: OEMString); var Written: Cardinal;...
Serjone
4
Он в одиночку это дело запилил или была какая-то команда?
Aquinary
12
~ 2m21s  nix shell github:nixos/nixpkgs#stack ~  stack ghc -- --version error: … while calling the 'derivationStrict' builtin at /builtin/derivation.nix:...
Rebuild your mind.
6
Всем привет, нужна как никогда, нужна помощь с IO в загрузчике. Пишу в code16 после установки сегментных регистров, пишу вывод символа. Пробовал 2 варианта: # 1 mov $0x0E, %a...
Shadow Akira
14
Карта сайта