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 ответов

91 просмотр

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.

Ненастная-Шляпа Автор вопроса
Платиновая Былинка
Your story would be different if you has db and AP...

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

Ненастная-Шляпа Автор вопроса
Плюшевый Химик
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

Ненастная-Шляпа Автор вопроса
Платиновая Былинка
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.

Ненастная Шляпа
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.

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

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

Господа, а что сейчас вообще с рынком труда на делфи происходит? Какова ситуация?
Мелодичный Сырник
29
А вообще, что может смущать в самой Julia - бы сказал, что нет единого стандартного подхода по многим моментам, поэтому многое выглядит как "хаки" и произвол. Короче говоря, с...
Фетровый Лингвист
2
30500 за редактор? )
Замшевый Алхимик
47
а через ESC-код ?
Виноградная Притча
29
Чёт не понял, я ж правильной функцией воспользовался чтобы вывести отладочную информацию? но что-то она не ловится
Сентиментальная Вершина
18
У меня есть функция где происходит это: write_bit(buffer, 1); write_bit(buffer, 0); write_bit(buffer, 1); write_bit(buffer, 1); write_bit(buffer, 1); w...
Отзывчивая Шестерёнка
14
Добрый день! Скажите пожалуйста, а какие программы вы бы рекомендовали написать для того, чтобы научиться управлять памятью? Можно написать динамический массив, можно связный ...
Клюквенный Як
7
Недавно Google Project Zero нашёл багу в SQLite с помощью LLM, о чём достаточно было шумно в определённых интернетах, которые сопровождались рассказами, что скоро всех "ибешни...
Волшебный Ленивец
5
Ребят в СИ можно реализовать ООП?
Стеклянный Граммофон
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 лет назад...
Укропная Путница
20
Карта сайта