Monday, May 18, 2009

There is always another way .. again

Ulf was right, io:format(user,Format, Args) does print on the console it's running on, which works out so much better for me than having to install any code previously on a VM. There is always another way, nice trick, thanks !! I will leave the code below anyway as a proof of concept that I did at least once in my life OTP compliant Erlang code :) !!

if anybody out there knows how to make a node ping the master node from the commands line, please let me know, so far I can only make this work with -mnesia extra_db_nodes [] -mnesia start. I tried -net_adm ping , but it does not work.

My favorite fun function of the month:

[net_adm:ping(X) || X <- nodes(known)]

While I could not have any exact documentation on what "known" stands for, it seems to be a list of all nodes from previous start ups, hence this function pings any previously known node and the result looks like a Wild West Showdown =).

But anyway, with the above modification in place, once a new server connects to the master node (where the load balancer runs) the code gets copied and started automatically, the new KVS2 database gets sync'ed and the output is now relayed locally, it works like a charm. KVS2 updates now always use the most recent record.

Currently in the works is the authorization scheme to channels and what users can use what commands. I am "erlagnizing" the concept to make pattern matching easy. I believe it's going to be divided into 4-5 table, a user table with groups/channels, guild info, allowed commands and revoked commands, an account level, factions and other stuff. Another table with the channel permissions, a table for account levels to differentiate guests from normal players or supervisors, a factions table, a guild table and last not least a commands resolver table that assigns commands permitted according to account level and channel permissions. Commands, will be the heart piece of the framework to enable players to move, fight, eat, sell, chat and other stuff, or supervisors to create new contents in run-time. The revoked commands are meant as a feature f.e. to silence a player, or make drinking during fights impossible, immobilize a player and other mean administrator things.

Cheers,

Sunweaver

4 comments:

B.Tolputt said...

Is KVS2 going to be an open-source component and/or have some more details outlined in future posts?

I ask because I am looking into the various databases (well, mainly - key/value stores) and there are alot of RAM-limited stores, but I have yet to find an efficient disk-based one. Does KVS2 keep everything in RAM like the others?

Sunweaver said...

Hello Benjamin. Right now KVS2 is in alpha stage, but it may become open-source in the future. And yes, KVS2 stores everything in RAM. Its main requirement is to quickly replicate data among "x" number of nodes to create a local DB cache/replica and provide extremely speedy lookups, while being resilient to changes in the node structure. It is not meant to store millions of records and only stores on disk for safeguarding. This fills in my requirement for a MMO, where speed is king.

But let me ask you, what do you call an "efficient disk-based" KVS ?? Do you seek to store large records (like blobs), many records, optimized for many threads, multi-node, write- or read-optimized ?? Let me know and I'll check if I can help you. Alrighty ??

B.Tolputt said...

OK, so if I understand the use-case of KVS2 properly then - it could be classified as a very large, periodically persistent RAM for the virtual world, yes?

I assume, then, that there will be another module used for storing/retrieving details from a database that does not need the highest speed possible, but rather a more reliable / consistent backend for billing, user accounts, etc?

Sunweaver said...

Hello Ben.
You are mostly right, hopefully the new post helps.