My recent experience on managing web hosting

aeric

Expert
Licensed User
Longtime User
I use both shared hosting and VPS hosting.

Recently I feel that my websites on shared hosting are getting slower. I just raise a ticket and within a few minutes, the support team replied and scheduled a server migration in the next 3 days. It is cheap to use shared hosting and simple to host some WordPress or PHP websites. The issue is I need to monitor from time to time that the server may get overcrowded and all the website domains parked under the same account become slow and affect the customer experience.

On the VPS, my current VPS package (openvz) is going to expired by end of this month. The server has been running great for years. The renewal price has go up a bit since the promotion for new customer was ended. Due to currency exchange rate, it has gone from $5 to $6 per month. The spec was very low but still decent to run 3 to 4 B4J servers on Ubuntu. Due to lack of resources, I thought to remove apache and use nginx server. Since start, the server is located in US and then I transferred it to Singapore (when it was available after that) which has the same timezone to my country. This is great for my data storing the date in local time.

So yesterday I saw there is a new package offer in the hosting panel. The new KVM package offer more RAM and Disk space. If I use a coupon code, I get a bit discount on the price for 2 years subscription. So I chat with the support, which I suspect is a Bot. It seems it didn't provide the accurate information. In just a button, I have subscribed to the new service and my credit card was charged. Then I realized the new package doesn't offer the server location in Singapore. The nearest server with lowest latency is in India which is 2.5 hours behind. I chat with a customer support. The guy answered me that I have no choice. So I have to live with the new server and I need to rewrite all my B4J server apps to handle the timezone difference. Due to different package, I need to manually migrate all my data too.

I first install the latest Ubuntu 24.04 LTS version to the new server. I check the resources used and found it is quite high. Then I tried to reinstall the OS with Debian 11. Eventhough it is not the latest version 12, I think it is good to go. I check and it seems uses much lesser RAM and processes. Currently the total RAM used is under 400MB. So I think I will stick to Debian 11 for my new VPS. With the new VPS, I don't have to worry for the resources and I think I can host like 10 to 20 B4J server apps.
 

aeric

Expert
Licensed User
Longtime User
I just got another reply.

Hi,

We have check there is no problem on the server.
The slowness you mention is probably due to network interruption between Europe and Asia traffic due to undersea cable cut which effect some of ISP.
You may try on other Internet connection to see will it help.
Thanks.

Regards,
Technical Support
 

peacemaker

Expert
Licensed User
Longtime User
with the new server and I need to rewrite all my B4J server apps to handle the timezone difference
How exactly is timezone used in B4J apps ? Why needs to rewrite ?
 

peacemaker

Expert
Licensed User
Longtime User
And how ? I mean, suggest what is important here to update in B4J code regarding the timezone, if you move the server location zone.
 

aeric

Expert
Licensed User
Longtime User
And how ? I mean, suggest what is important here to update in B4J code regarding the timezone, if you move the server location zone.
My app was saving the timestamp by default when inserting new row. The timestamp is auto generated by the database server.

When I changed the server from US to Singapore, I just let it uses the GMT +8 timezone which corrected the differences.
I was "lazy". I take things for granted and let the timestamp follows the server's timezone.
Now it is backed to UTC 0.
Meaning, when I insert the data, I will see the timestamp is behind 8 hours.
 

peacemaker

Expert
Licensed User
Longtime User
So, if to going on storing the important records in the same DB (some statistics, user account archive...) at new location, it looks like the server timezone must be set again as before, to +8.
 

aeric

Expert
Licensed User
Longtime User
Actually, for displaying purpose, I can use JavaScript to format to visitors from different part of the world.


But let say I need to return the date value into API from the database server then I need to figure out again the logic for the client app to convert it to the local date time.
 

aeric

Expert
Licensed User
Longtime User
Related story on storing date or timestamp values to database:

 

peacemaker

Expert
Licensed User
Longtime User
Stupid ot not, i'm always use 2 fields in the tables: time and stamp.
"time" - it's always milliseconds from DateTime.Now as "absolute time" for calculations.
"stamp" - it's formatted readable "data-time-msec-timezone" timestamp string, local one of the record creating client, just to show.
And i use so in SQLite local db and in MySQL also, without database server's auto-timestamp.

Maybe stupid, but.... works for now.
 

aeric

Expert
Licensed User
Longtime User
Stupid ot not, i'm always use 2 fields in the tables: time and stamp.
"time" - it's always milliseconds from DateTime.Now as "absolute time" for calculations.
"stamp" - it's formatted readable "data-time-msec-timezone" timestamp string, local one of the record creating client, just to show.
And i use so in SQLite local db and in MySQL also, without database server's auto-timestamp.

Maybe stupid, but.... works for now.
what if the time is near midnight?
You may need to +1 or -1 the day.
 

aeric

Expert
Licensed User
Longtime User
I can use JavaScript to format the timestamp for visitors from different part of the world.
I just applied the adjustment.
My Support Ticketing System is now displaying the local time according to user's UTC. Instead of server's local time, the timestamp is now saved into database as UTC time.
 

aminoacid

Active Member
Licensed User
Longtime User
How exactly is timezone used in B4J apps ? Why needs to rewrite ?

Why don't you just set the server (VPS) time to the time zone that you need using "timedatectl" ?
I have a couple of VPSs. All of them are hosted in Philadelphia which is US Eastern Time Zone. One runs a WRF model and mySQL DB server and a B4J data ingest application. for meteorological data in US - Central Time Zone and all date/times have to be in CDT, so all I did was set the VPS clock to CDT:

timedatectl set-timezone "America/Chicago"

Your VPS does not have to be hosted in the same time zone. It can be located anywhere in the world.
 

aeric

Expert
Licensed User
Longtime User
Why don't you just set the server (VPS) time to the time zone that you need using "timedatectl" ?
I have a couple of VPSs. All of them are hosted in Philadelphia which is US Eastern Time Zone. One runs a WRF model and mySQL DB server and a B4J data ingest application. for meteorological data in US - Central Time Zone and all date/times have to be in CDT, so all I did was set the VPS clock to CDT:

timedatectl set-timezone "America/Chicago"

Your VPS does not have to be hosted in the same time zone. It can be located anywhere in the world.
It wasn't allowed in the previous plan. I haven't tried in current plan.
 

aeric

Expert
Licensed User
Longtime User
Recent shared hosting migration breaks my PHP apps. The problem found in MySQL 8 which doesn't allow my timestamp to be "0000-00-00 00:00:00" which was my mistake. It's been a long time I don't write PHP.
 
Top