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

23 просмотра

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.

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

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

@MrMiscipitlick А можешь макрос написать, который будет вычислять смещение относительно переданных меток? Просто .label1-.label2, и вернуть значение.
КТ315
35
я не магистр хаскеля, но разве не может лейзи тип конвертнуться в не-лейзи запросив вычисление содержимого прям при инициализации?
deadgnom32 λ madao
100
А еще в перле можно уже @arr1 + @arr2?
Sergei Zhmylove
53
Подобного рода ;Следующие три строки это директивы ассемблера, ;которые можно не задавать, т.к.работаем в Visual Studio. ;Символ ";" - это начало однострочного комментария ...
Егор Анелькин
3
Кто-нибудь знает почему SPM клонирует репо целиком? Некоторые репы просто огромные, как та же swift-syntax которая нужна для использования макросов. Сначала подумал, что это...
iMike
6
Привет всем. появился вопрос. Разрабатываю сайт, в данный момент он запущен. Хостинг beget. Добавляю на сайт яндекс метрику с помощью полей client-settings (взято отсюда http...
Andrew
2
Подскажите, где смотреть результат выполнения программы? Код: ;.686 ;Система команд процессора 686 ;.MODEL FLAT,stdcall ;Модель памяти плоская, станда...
Егор Анелькин
5
еще вопрос, допустим мы создадим char массив из 10 элементов и присвоим ему через сканф 10 символов. и выведем все символы. Хотел спросить последний элемент /0 будет включать...
Anthem
11
открыть папку в проводнике: 1 - ShellExecute 2 - ExecuteProcess 3 - OpenDocument что лучше выбрать?
Alexey Kulakov
12
;.686 ;Система команд процессора 686 ;.MODEL FLAT,stdcall ;Модель памяти плоская, стандартный ;вызов процедуры ;option casemap:no...
Егор Анелькин
1
Карта сайта