Page 1 of 1 1
Topic Options
#208190 - 2013-12-23 08:25 PM KF Sockets
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
I've got a question regarding the user of Socket communications via KixForms.

I'm thinking about a service that hands out configuration settings for an app. When the app starts up, and every 1-4 hours thereafter, it will check in. It will make 4 specific data requests, which the server will look up (initially in an INI but later in a SQL table) and return to the client. The client will be on every server, from 20 to around 500 servers depending on the environment.

If I have the server listening on, say, port 4500, should I have the server service respond directly, or should I spawn a second, temporary listener and have the server simply reply with the child's port number? The client would then communicate with the child listener on the specified port, and the child would terminate after the final query or 60 seconds. Basically, I'm wondering if a single listener could process simultaneous requests from multiple clients.

FYI - the query is generally in the format "HOST:REQUEST_ID" and the response, based on the Request_ID, is under 1K. Occasionally (once monthly), the client would send about 200 bytes in addition to the host ID and Request ID.

Thanks for your thoughts..

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#208198 - 2013-12-24 01:29 AM Re: KF Sockets [Re: Glenn Barnas]
Björn Offline
Korg Regular
*****

Registered: 2005-12-07
Posts: 953
Loc: Stockholm, Sweden.
My five cents would go on spawning children from the beginning - and handing connections over based on availability and current workload.

Perhaps a simple checksum stream in the middle?
 Code:
Client > Server : Hi. (fixed port initial com)
Server > Client : Yo, I'm the child spawned, version, checksum? (port change)
Client > Server: Version X, checksum Y
(in case of no updates:)
Server > Client: Latest. See ya.
Client > Server: Kthnxbye.
(in case of updates:)
Server > Client: Check this out, Z
Client > Server: K, got it. 
Server > Client : Yo tell me again - version, checksum? 
Client > Server: Version X, checksum Y
Server > Client: Latest. See ya.
Client > Server: Kthnxbye.


Sorry Glenn, perhaps not the feedback you wanted, but I do love comms ;).


Edited by Björn (2013-12-24 01:29 AM)
_________________________
as long as it works - why fix it?
If it doesn't work - kix-it!

Top
#208201 - 2013-12-24 03:34 AM Re: KF Sockets [Re: Björn]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
Actually, that's similar to what I did in a prior project. That one had an authenticating checksum in the first packet, as it was used to set up a file transfer session. It would spin off up to 10 file sync sessions.

Since this app integrates with WSUS and our system service that manages WSUS updates, even with 500 servers, with a 60 minute check-in cycle (more common is 2-4 hour and up to 12 hour), the concurrent load is pretty small, and packets are small - request payloads are <20 bytes, and responses are < 60 bytes. Timing isn't critical for this app - basically the client says "HOSTNAME:WHEN?" and the server does a lookup and replies "3,6,22:00" (Third Saturday at 10pm). The point of this is to not use INI or REG entries on each system to define when updates are installed. It can request/send other settings, but those are for startup (DEBUG Returns 0/1), VERSION (returns a version string and Update Path - the largest at about 120 bytes typ.)

This is one of our low/mid end products that currently supports per-server config files, allowing a simple WSUS server to be used to target MS Updates to a specific monthly change window. Changes start precisely (+0/-1 second) at the defined time, install repeatedly until all updates are applied or the change window expires, rebooting as many times as needed. With central management and configuration, smaller organizations can have a low cost version of systems like Tivoli/Big-Fix with much less training and management overhead.

The release I'm working on will use an INI file on the server for up to 100 managed servers, and will pave the way for a larger, SQL-based system. Leveraging our SWDIST technology, we can deploy multiple management servers and allow the client to located the closest server using DNS SRV Records.

So - thanks for the ideas.. (I had to think about "kthanxbye" for a bit, though! ;\) ) One question.. I had thought about
 Code:
Client > Server : hi, host here, Connect?
Server > Client : hi, server Ack, use port 10400
Client > Server:104000 - Host, Request XXXX, CSum
and so on...
This would end when the Client sent a "Host,EOT" message, or no communication was received for 90 seconds or so. Your example shows the host replying via the spawned channel on the secondary port. I'm not sure how that would work.

Thanks,

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#208206 - 2013-12-24 11:10 AM Re: KF Sockets [Re: Glenn Barnas]
Björn Offline
Korg Regular
*****

Registered: 2005-12-07
Posts: 953
Loc: Stockholm, Sweden.
In my mind, I think the process-chain would look like this:

The spawned listener that is "using" 10400, does all the communication.
The main process, gets polled by the child. Meaning the child is "dumb";

All access to the INI/DB is handled by the master pid.
The master process has the ability to spawn new processes depending on if the child becomes "stuck" during comms, since it grabs the first initial comm.

Or, you could have one process doing the handoffs of data, and one listener - since you will have "low amounts of data" passing over.

What I am aiming at is separation of ownership and what data is servered by what pid.

This could mean, that for the low end segment that uses a INI, you need one engine, and for the SQL-driven, you have another. But, the listening service/child remains the same as it handles the same kinds of data.

Sadly, I have no idea how to do any of this with KF ;).


Edited by Björn (2013-12-24 11:13 AM)
_________________________
as long as it works - why fix it?
If it doesn't work - kix-it!

Top
#208208 - 2013-12-24 04:09 PM Re: KF Sockets [Re: Björn]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
AWESOME!
I love seeing that sockets was not implemented in vain!

I mean, they did get used in games before, but this makes me smile.
_________________________
!

download KiXnet

Top
#208211 - 2013-12-24 04:57 PM Re: KF Sockets [Re: Lonkero]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
Lonk,

I have a couple of KF-Socket apps! (and not games, either!)

One is a client that runs on workstations and allows the help desk to make queries to the system to obtain information about hardware, installed software, services, and processes. It's an enhancement to the System Interrogation Tool that radically improves performance. SIT will attempt a socket query to the listener on the client. If it can't successfully negotiate a connection, it drops back to authenticated WMI queries. A full WMI query over the LAN could take 20-30 seconds, but the KF Socket based listener reduces this to under 2 seconds.

Another is an app that synchronizes directories between a master and multiple secondary servers. The secondary servers make a connection to a listener on the master server, who - after a successful negotiation, will spawn a copy of the Unison file sync software, listening on a defined port. It will then respond to the client, reporting a successful service start on a specific port. The client then establishes the sync with the specific Unison listener. We've used this in syncing web farm servers as well as keeping documents sync'd with servers around the globe. We chose Unison because we could sync with Linux systems running SAMBA, and the client adapted to run natively in Perl. The Kix/KF service allowed the master server to only run the Unison sync apps when needed, minimizing the load of having one Unison app per remote server.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 466 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.054 seconds in which 0.023 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org