Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add persistent server storage with MongoDB #9

Closed
wants to merge 7 commits into from
Closed

Conversation

ShadowNinja
Copy link
Member

Tested, but still needs some more work.

It would help if there was something to uniqule identify each server -- currently we just have ip and port, but those often change.

Why?: right now mainly just saves extends popularity values, but can be used for things like uptime-as-a-percentage.

This makes some options non-optional -- allowing for a smaller config file.
This also removes the X-Sendfile example, bucause the proxy server should
handle static files directly and the option is not at all specific to this
particular application (and general Flask options aren't documented).
This should be handled at a higher level, such as in NetFilter or the proxy server.
I only added this feature because the old server list had it.
There's just not really a compelling reason for this to be configurable.
This is a standard way of indicating requirements for
Python projects, since it makes it easy to automatically
install all needed packages with the correct versions.
@nerzhul
Copy link
Member

nerzhul commented Jan 26, 2016

Why add another technology on MT components ? Redis could be used there instead of ugly mongo db. MongoDB is overkill and pure shit technology for NoSQL, just useful for devs.

@ShadowNinja
Copy link
Member Author

@nerzhul: MongoDB integrates very well with the server list because it's JSON-based. Redis doesn't support multiple indexes AFAIK, and SQL-based databases require schema updates with every new field.

@est31
Copy link
Contributor

est31 commented Jan 29, 2016

I don't really know which of the two is better, but if mongodb is built for json... why not.

@sfan5
Copy link
Member

sfan5 commented Jan 29, 2016

but if mongodb is built for json... why not.

I'll tell you why not:

It's a god damn server list for a few (~150) game servers, we aren't an enterprise that needs any of that NoSQL bullshit to run queries on our 500TB database. Writing a JSON file to disk is completly sufficient and doing anything else is just adding unneeded complexity to an otherwise really simple setup. I don't want to install a database server that uses 20GB of memory just to run server list handling 2KB of data.

@nerzhul
Copy link
Member

nerzhul commented Jan 29, 2016

@sfan5 thanks, and i have mongodb in my enterprise for 200GB of data and mongodb is just a pain. it's useful for developpers but not for devops or infrastructure engineers. Also mongodb 3.2 switched partially to postgresql + JSONP backend => then lol

@ShadowNinja
Copy link
Member Author

It could be saved to a seperate JSON file, but that would require O(N) time for all lookups. At best we could make one type of search run in O(log2(N)) time by sorting the list on that index and using a binary search. This might not be an issue if we only have a few servers -- but remember that they're persisted for a while -- even small temporary servers, so we should plan for around 1000 entries.

Also, this will become more painfull if features like centralized player login are added to the master server.

I'll take a look at using a single-file based DB.

@sfan5
Copy link
Member

sfan5 commented Jan 31, 2016

Why do we need to persist servers at all?

Also, this will become more painfull if features like centralized player login are added to the master server.

If we add centralized player login to the master server I'll happily use a MySQL database for this.

@rubenwardy
Copy link
Member

rubenwardy commented Feb 18, 2018

Why do we need to persist servers at all?

Reliable server age


Also, this shouldn't persist the whole /list, only certain items. I suggest:

  • Server address / port
  • Date first seen (for age)
  • Average players
  • Last known server_name

It's worth thinking about what happens if a server changes IP and doesn't use a domain name. ie: is it worth adding the ability for server owners to contact sfan5 and have the server address and port changed for a certain entry.


Saving to JSON could become a DDoS risk, so would need to have protections. ie: not writing every time the record changes.

@nerzhul
Copy link
Member

nerzhul commented Feb 18, 2018

just use postgresql, and json field for non structured data if you want it. It's faster than mongodb and more reliable :)

@rubenwardy rubenwardy closed this Feb 3, 2019
@rubenwardy
Copy link
Member

MongoDB is proprietary, and this hasn't been updated in years anyway

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants