Jump to content

Wikipedia:Reference desk/Archives/Computing/2020 February 5

From Wikipedia, the free encyclopedia
Computing desk
< February 4 << Jan | February | Mar >> February 6 >
Welcome to the Wikipedia Computing Reference Desk Archives
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


February 5

[edit]

Server or PC?

[edit]

I need to setup a simple Internet server. I have an option to purchase, or even take from my old storage a computer and install MS Server software, or on the other hand I can purchase a new Dell entry level server like this one: [1]. I hope it will have server software installed on it. What would be the difference?

Thanks, - AboutFace 22 (talk) 15:34, 5 February 2020 (UTC)[reply]

Hardware:
A server is optimized for reliable, fault tolerant 24-hour operation while using as little power and physical space as possible. In particular, the video will be fine for static 2D (Windows or Lixux desktop, web browsing...) but will absolutely suck at gaming.
For your application, I suggest a used Dell PowerEdge R610.
https://www.amazon.com/dp/B07QJ6WTV7/
https://www.amazon.com/dp/B00HDAGDLK/
https://www.amazon.com/dp/B07R7XMKK5
At these prices you can afford to buy one, set it up and see if you are happy with it, then buy a spare.
There a are a huge number of perfectly fine R610s on the used market because for someone running a server farm it makes financial sense to replace multiple R610s with a single high-end virtualization server. These servers typically spent their previous lives in a climate controlled server room and are in like new condition.
Software:
You do not want to use Microsoft server software with IIS. If you get it with the server, put it on the shelf. Instead, you really want to run a Linux server and Apache.
Here are some good choices:[2] If in doubt, try Ubuntu first.
Here is a good page about setting up the web server:[3]
Questions
Is this going to be on the Internet, or will it be a private server on your LAN?
How many users at once? And what will they be doing? browsing a static website? Minecraft server? Uploading and downloading large files? I can give you better advice if I know more about the load. --Guy Macon (talk) 17:09, 5 February 2020 (UTC)[reply]
BTW, the R610 draws 15W at idle and 260W with all twelve cores running a heavy load. I would guess that in your application it would spend most of its time under 30W with peaks of maybe 100W when a bunch of users are hammering on the web server.
Review:[4][5]
--Guy Macon (talk) 18:44, 5 February 2020 (UTC)[reply]

Guy Macon, thank you for a comprehensive advice. I kind of thought along the same lines, except for the Linux server. I do have considerable experience with Linux applications, C++ etc. The purpose of the server is a possible fundraising. I have 4 US patents on a particular invention. They are on the Internet, of course. I plan to collect them all in some pages, write a business plan, post some computational results, etc and limit the access to the website to people whom I consider potential investors and whom I have contacted and offered to check it out with passwords. That's it. I've never done gaming or anything of that nature.

Thank you, - AboutFace 22 (talk) 19:57, 5 February 2020 (UTC)[reply]

Given the above new information, I would change my advice. Get a domain from Gandi.net, hosting from pair.com and email from Tuffmail.com. There are other good vendors, but I have personally tested these three. Prices are OK (not the cheapest, but not bad) reliability is very good, and all three have a reputation for protecting your privacy and not being idiots who keep getting hacked.
I do not advise buying the above three services from a single vendor.
With the above setup, if Pair goes belly up you can buy web hosting somewhere else and have Gandi point to the new web server. If Tuffmail dies you can buy email hosting somewhere else and have Gandi point to the new web server. If Gandi dies you can still access Tuffmail and Pair through their web interfaces even though the domain doesn't resolve, and you can hire a new domain name provider who will go through the special hoops you have to jump through to take over for a dead domain name provider.
Consider what happens when everything is provided by dodgydomains.ru: One day your website disappears. Is it the hosting? You call but the dodgydomains phone is disconnected, the dodgydomains email bounces and the dodgydomains website no longer exists. So you decide to call your domain name service and have them point to a new host. You call but the dodgydomains phone is disconnected, the dodgydomains email bounces and the dodgydomains website no longer exists. Same problem with the email server. This can be a real pain to recover from. --Guy Macon (talk) 21:04, 5 February 2020 (UTC)[reply]
  • Guy's given you some good advice re server hardware (and OS), although I'd disagree on two broad points.
- I'm not a fan of this type of deep rack-mount when they're on their own. Great when you have a whole rack of them, but as an individual it's an awkward shape.
- More importantly, I don't think anyone should be running a single internet server. Either run a whole farm, or rent server space from someone who is. There's a lot more to this than just the server and it's nearly as awkward to run one (competently and protected) as it is to run a rackful. For another thing, your staging environment (dev, test and live servers) probably need two or three boxes (only one externally-facing) more than just one.
On the whole, I'd rent space from somewhere that's already hosting stuff. There's a plethora of such places, from Amazon AWS downwards. AWS isn't a bad way to go either, as it's much more flexible than simple server rental. But just buying a server and plugging it into the interweb is just asking for trouble. Andy Dingley (talk) 20:26, 5 February 2020 (UTC)[reply]

Many thanks everyone for incredibly useful comments. AboutFace 22 (talk) 03:15, 6 February 2020 (UTC)[reply]

I would say that not many hardcore systems geeks run server-class hardware at home. Especially in the age of virtualization, you could easily go get a Digital Ocean droplet and have a nice, well-configured and usable server "out there" on the Internet to do what you want.
Besides the power requirements and exotic hardware of a server, there is another reason you do not want it in your home. Your Internet Service Provider has a Terms of Service that designates your connection for consumer use only. You can negotiate a business-class account with them, and pay lots more, but a consumer Internet connection does not have suitable technical characteristics for handling server-load and their Terms of Use may indeed specifically prohibit the "running of servers" over the connection. Elizium23 (talk) 03:23, 6 February 2020 (UTC)[reply]
  • Plenty of geeks run server-class hardware at home, especially if we work from there. We just don't connect it to the public internet. Even if I want it accessible from some of the internet, or only accessible to myself when I'm mobile, I'd host it in someone else's data centre. Andy Dingley (talk) 17:42, 6 February 2020 (UTC)[reply]
If you just want to host some web pages and you don't want to use shared web hosting, the easiest thing to use is a VPS (virtual private server) of which the Digital Ocean (DO) droplet mentioned above is an example. You can get some free DO credit for signing up: search for "Digital ocean signup coupon" or something like that. It will let you test it for a month or so. DO's main competitors are linode.com, vultr.com, and a few others. They all have similar coupons. 2601:648:8202:96B0:0:0:0:E118 (talk) 04:12, 6 February 2020 (UTC)[reply]

Thank you very much. Very impressive. AboutFace 22 (talk) 01:15, 7 February 2020 (UTC)[reply]

Is this an antipattern?

[edit]

I found some strange code at work in the ASP.NET Core application I'm developing.

When a controller needs to report an error situation, it calls a method in another class, giving itself as a parameter. This other class then calls methods in the controller, through the parameter it got, to write the error message in the reply. I changed it so the other class is not needed, the controller calls its own methods directly.

Is the former situation an example of some antipattern? JIP | Talk 21:48, 5 February 2020 (UTC)[reply]

That's a type of callback and sometimes it is the right thing. Other times it's an additional and unneeded moving part. It's not inherently an antipattern. 2601:648:8202:96B0:0:0:0:E118 (talk) 04:08, 6 February 2020 (UTC)[reply]
There is not enough detail in the information in the question to give a reasoned answer. It depends. Possible justifications of using a callback include separation of concerns and avoiding code duplication.  --Lambiam 11:27, 6 February 2020 (UTC)[reply]
More specifically, callbacks can be used for implementing inversion of control, such as needed for the dependency inversion principle, intended at keeping separable concerns separate.  --Lambiam 11:41, 6 February 2020 (UTC)[reply]
@JIP: It's not a big cost to perform one indirect call, especially in a non-time-critical part, whilst it adds one more level of flexibility. See e.g. the UML sequence diagrams at Observer pattern#Structure or Visitor pattern#Structure – both patterns use the scheme of object A calling a method of object B, which then decides if/what A should do. The flexibility arises in that you can replace the B object with another logic implementation, thus modifying the whole solution's behavior without touching the A class.
In your specific case, are you sure the 'other class' is the only class your controller will ever see in this situation? Does the controller class use the 'other class' as the other class' object properties and functionality, or may be it relies on some 'other class base interface'? Possibly in some configurations the 'yet another class' may implement a more sophisticated logic behind the same interface, for example record a trace of an error in some additional log, or send notifications to some other observers, not used in your application. This is more than probable if your controller class is used in other projects, in which it cooperates with different environments. If this is the case, your shortcut is very likely to break those other projects.... --CiaPan (talk) 12:19, 6 February 2020 (UTC)[reply]
The classes are in the same project, and the controller is not used from any other project. The "other class" is the only class the controller sees in this situation, in fact it was hard-coded into the controller method, not given as a parameter or read from a setting. And the controller never uses any of the "other class's" properties, all this method does is call the same controller back. JIP | Talk 12:23, 6 February 2020 (UTC)[reply]