0

I would like to create a logging server/service that stays resident and gets called by a webstore to handle different levels of log messages. There can be many copies of the store running at the same time, so the server will need to handle many messages arriving at the same time without data loss, ideally multi-threaded and buffering data for efficient posting to a TBD storage system.

Is TIdSysLogServer multi-threaded? Is there a better approach? Currently, each instance of the store writes to a text file log, but as the number of instances grows there is more contention for the text file and delays.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
richSPI
  • 1
  • 1

1 Answers1

0

Is TIdSysLogServer multi-threaded?

Yes, but only in that it runs a separate reading thread for each listening Binding you define. So if you only have 1 listening port, you will have only 1 reading thread.

Also, TIdSysLogServer is a UDP-based server, so packet loss is always a possibility even for low traffic, but especially for high traffic. You can increase the listening socket's underlying buffer size via TIdSocketHandle.SetSockOpt() manually, and that may minimize the possibility of packets being discarded in high traffic, but there is still no guarantee that packet loss will not occur at all.

If you need reliable packet delivery, use a TCP-based server instead. For a high rate of performance, consider using asynchronous/overlapped I/O (which is something Indy does not support in its TCP servers)

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
  • I think syslog is a BSD standard. Any idea why they would use UDP vs TCP a loss-less packet delivery protocol? Seems like losing critical log messages is bad. Any recommendations for delphi logging packages? thanks remy – richSPI Sep 17 '19 at 17:00
  • The [syslog protocol](https://tools.ietf.org/html/rfc5424) itself is transport-agnostic, but there are [TCP+TLS-based](https://tools.ietf.org/html/rfc5425) and [UDP-based](https://tools.ietf.org/html/rfc5424) transport specs defined for it. Indy currently only implements the UDP variant, but it wouldn't be hard to implement a TLS variant using `TIdTCPClient`/`TIdTCPServer`. – Remy Lebeau Sep 17 '19 at 21:53