From PHP to NODE and back to PHP

I developed an auction website with PHP using and action scheduler. All of this worked well, but as soon as you get to more than about 250 users on the site it started to cause a few problems because of all the requests. If you on shared hosting or a host that limits your max children and max sql connections.

So then everybody said go NODE… go NODE… WebSocket’s is king… for this… So I went down this rabbit hole… it was a big learning curve and to be honest PHP server connect and in general PHP is way more forgiving than NODE… but never the less the site was converted to Node with websockets and working like a charm….

I loaded this to Digital Ocean and great… its working!.

BUT 2 things that became a BIG issue…

  1. Cost of running on cloud. You cannot run a site like this on anything less than 4GB of RAM. So out of the gate its was costing 20 – 24 USD… then if you want to make sure you have a backup. Add another 4 – 5 USD ----- SO now its 30USD for hosting a month…

  2. SPEED…. Because I selected London as my server… the pings are from 140 – 180ms…
    As they do not have a sever here is South Africa… and that causes a big issues in speed if you running a auction site…. Maybe if DO had a sever here and we were getting 30 – 50ms then we could still bite the bullet for 20 - 24 USD without backups per client….

So… the next step was to use AMAZON in Cape Town…
When you see AWS costs!!!. then you want to run even more…. For the same things as DO … you are looking at 35 – 40 USD … CRAZY!!

So 15 clients x 35 USD = 525 USD a month!!!

AWS should give me better speeds than DO… but at the cost…… my clients wont be happy….
As you would need to increase the cost to client with 35% overnight……

Don’t get me wrong Node is great… it works so so smoothly with WebSocket’s for the Realtime data, but in reality if you don’t have a open big budget… then you might want to reconsider.

SO… BACK TO PHP!!! Good old faithful. @JonL (might unfriend me now)
The only reason is because of the factors of the above……

The cost of the dedicated server(php) is nothing compared to having separate sites on AWS! We opted for a dedicated server and added 64GB of RAM to it… overkill… as this sorts out our “action scheduler” problem. Setting the PHP setting max children and max connections to optimum. Now the cost works out to max 10 – 12 USD cost to client… and we have a “managed dedicated” server… backups, ssl auto install, security and doss protection (where you on your own with DO)

Dedicated (managed) server cost a year 1200 USD
Hosting multiple sites of other clients, not just auction sites covering the cost is a no brainer…

The speed is back to 30 – 50ms … I know it does not sound that much of a difference. but trust me with the auction site… it’s a HUDGE difference…

So in a nutt shell
Node is great with WebSocket’s providing real time data! …
But take into consideration your location, the cost…and speed… not just the hosting. But all the add-ons. AWS… backups… routing… SSL… S3… load balancers (if needed)……

I dont have any regret learning Node…as i have gained experience… as i have a fully working auction site done with node…smooth as butter. Just a pity the above factors wont allow me to use this…

3 Likes

The first few google results for SA hosting companiess supporting nodejs show me that you can get a node hosting for R767.84 a year. Unlimited RAM, unlimited almost everything, daily backups etc. Was that not an option for you? Docker is NOT required for running a nodejs website, so DO and AWS are not all your options :slight_smile:

They all say they are South African!! they are only resellers… if you look at our forums here… AWS is the only real local node hosting…

1 Like

So companies offering PHP hosting are the only ones having their hardware in SA? Have you tested the connection/loading speeds of any of these companies providing nodejs hosting there?

If you look at the local forums here… its an issues… everbody wants node hosting… that is a out of the box solution with not much configuration at decent price…

you can get a server dedicated server with afrihost that is going to cost R 1570 per month. But then you still need to set this all up eg install node module via cpanel… @psweb has done this before.


So this could be a solution for the future…

I won’t unfriend you, but I won’t be able to help you with extensions :joy:

It seems to me it’s more a geographical issue than a tech stack issue. And if that’s the case you are screwed because being limited by that sucks.

2 Likes

It sucks balls… because of all the work that went into it… but not all lost… as i have learned so so much…

At least if I have a client that really wants a websocket version and willing the pay the cost of the hosting… well then i have the solution… thanks to you and many others that helped… as the node version is great…

Just one of the requests on Digital Ocean… to open up a data center here in South Africa.

at least my pings was 140 – 180ms

London

ping 46.101.10.5

  • 64 bytes from 46.101.10.5: icmp_seq=0 ttl=53 time=190.671 ms
  • 64 bytes from 46.101.10.5: icmp_seq=1 ttl=53 time=193.604 ms
  • 64 bytes from 46.101.10.5: icmp_seq=2 ttl=53 time=193.900 ms
  • 64 bytes from 46.101.10.5: icmp_seq=3 ttl=53 time=207.577 ms
  • 64 bytes from 46.101.10.5: icmp_seq=4 ttl=53 time=193.531 ms
  • 64 bytes from 46.101.10.5: icmp_seq=5 ttl=53 time=193.787 ms
  • 64 bytes from 46.101.10.5: icmp_seq=6 ttl=53 time=193.417 ms
  • 64 bytes from 46.101.10.5: icmp_seq=7 ttl=53 time=194.579 ms
  • 64 bytes from 46.101.10.5: icmp_seq=8 ttl=53 time=193.905 ms
  • 64 bytes from 46.101.10.5: icmp_seq=9 ttl=53 time=194.257 ms
  • 64 bytes from 46.101.10.5: icmp_seq=10 ttl=53 time=192.390 ms

Radical idea - and lots to consider first - but buy and operate a server yourself? It isn’t that difficult these days, especially with containerisation doing much of the heavy lifting. Might be a bit costly up front but would quickly provide ROI by the sounds of things

Yes, was thinking about that… but the problem is i have NO server experience… things that pop in to mind… security… patches… doss attacks… if you get a self managed server then all those things become your baby… and i have so much on my plate already… to still try figure out how to do that will just be a mission… and to pay somebody all the time to do it… well then it defeats the point again… :slight_smile:

Thanks for the suggestion. I will have to put all the ideas on the table and see what will be best.

1 Like

AWS lightsail is a less expensive option.

1 Like

Not available in Cape Town region …

Can’t you use this dedicated server for NodeJS too? You can run multiple apps too

Edit: Just saw the comment above, you can install Plesk (or cPanel) and most of your problems are okay I think

1 Like

Its a managed dedicated server… so no… is the short answer… i have asked…

If i go with a fully self managed server then yes… but as said above it comes with its own can of worms… eg configuration… security… patches… and i have no knowledge to do this… and to busy with other work to become a system admin :slight_smile: :slight_smile:

But I will speak to @psweb as he has a dedicated server with afrihost … and will find out about the “security, configuration and setup part”

But for the record… i am very impressed on how php is handling the requests with the action scheduler… way better than expected… when you configure the settings and dump memory on the server…

From what i understand from many interesting conversations with @psweb, the infrastructure is such that he spends a lot of time running on backup generators in SA. Not sure self hosting is a good idea if so.

Yes you wont want to setup a server at your work / office. Rather keep it with a hosting company that offers rackspace or self managed dedicated servers here in South Africa…We use xneelo… the have at least all these generators and backups in place…

At the office i have a inverter system that lasts 2-3 hours… you cant go without this anymore in South Africa…

We have load shedding… meaning we have power cuts 2 hours per day… up to 6 - 8 hours in places… welcome to Africa… :slight_smile: :slight_smile:

Lol, yeah, South Africa needs different setups than the rest of the world, I just came out of no water for 3 weeks too.

I use a self managed server with Afrihost who runs off the MTN data centers in Johannesburg which have full backup power etc.
The only reason I have never liked Hetzner / Xneelo is because of their proprietary software they give you to use instead of WHM/cPanel. Otherwise their infrastructure is great, but that management dashboard, yikes I just can’t.

I have a UPS at home, connected to an inverter, which gives me instant switch over power for 5 computers and 3 really large monitors, this can last about 2.5 hours on full load, which is what i use for those very late night load shedding experiences so I do not have to turn on the generator and wake the family, but during the day the UPS/Inverter takes the first few seconds before a 7.5kva generator kicks in to supply the entire house including the UPS/Inverters. Alas this is all I can do from my end, as I then rely on the government telecommunications company for their infrastructure, which means, although my own fiber modem is powered, the box 1 kilometer away from me it gets internet from dies in 15 minutes, so I get internet for 15 minutes after power cuts only.
When I complain, I am normally told the inverter batteries were all stolen, most of them before they were even put into their designated boxes, which is why they switched from copper ADSL lines to fiber in the first place, as the copper lines kept getting stolen.
As I say South Africa is just a different place, and there is only so much you can control before getting hit by government corruption, theft, loadshedding, water cuts, etc.

Anyway the point behind that long saga above, is that half my reason for switching from PHP to Node was actually because of the built in servers, so I could avoid running LAMP, MAMP, WAMP etc. and could do it all locally when I have no internet, power, etc.

2 Likes

What!!! No water for 3 weeks! that is insane… well welcome to Africa… and we had a taste of stage 6 yesterday… its like we going back to the stone age and not into the future here…

Xneelo now has a new control panel, recently launched… but on a self managed server you can get whm / cpanel. Seems like Afrihost and Xneelo is on par…

When people read your message above they must think you stay in the bush with lions walking around freely… as it sound like you in a “real” African country…

Well all the best that side as I dont see loadshedding going away for the winter…

1 Like