Apache, PHP, etc. vs B4J?

KMatle

Expert
Licensed User
Longtime User
Sometimes it feels like php or other backends are "unwanted" here Many threads end like "just use B4J" which may not fit/may not be satisfying for some users. B4J is NOT a standard for backend servers, Apache, php, .aspx, etc. is. I use B4J as a frontend a lot, but not as a backend server.

What do you think?
 

AHilton

Active Member
Licensed User
Longtime User
I suspect that if you go to an Apache, php, .Net forum and try to get developers to discuss B4x very much, you'd get similar feelings. Go to a hammer forum and discuss screwdriver usage or vice-versa, you'd likely feel like that again. I wouldn't go to an Audi car forum and be discouraged with the responses when I want to know how xyz transmission from a Saab car can be used in the Audi. This forum is, mainly, about B4x usage and it shouldn't be a big surprise that most of the discussions are about that and how it can be used in different situations. Not that interoperability with other technologies is discouraged. Far from it.

One the great aspects (and one that I'm depending heavily on) is that a B4j backend server can be used with many frontend 'languages'. And, my B4j backend servers run very well alongside and in conjunction with my Apache servers. They each have their own uses.
 

sorex

Expert
Licensed User
Longtime User
I think it is normal that a company (Anywhere Software) promotes their own server solutions (B4J) and I don't have a problem with that since it opens a lot of doors aswell.

Which doesn't mean the others are bad or worse.

I guess it all depends on what you want to do.

if you want to work with sockets or scheduled jobs then it's probably easier with B4J than with cron jobs and standard sockets. (see vps below)

if it is just query based data sharing/collecting I would go for php+mysql since
-it's the standard combo on most (free) linux webhosting packages (windows hosting is/was more expensive)
-it's easier to change and test queries in a php textfile than to alter the config files for the B4J solution and maybe a restart of the B4J app to update the query list.
-it works on your cheap hosting while the B4J solution requires a vps solution (more expensive) unless you can convince your hosting partner to allow port forwards and running non standard background tasks.

It's all a matter of taste and you still have the choice to pick what you prefer which is good.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can of course use whichever backend you like.

I wouldn't compare Apache to B4J server. B4J server can run together with Apache (there are 4 B4J servers running on the same Linux computer that hosts this site together with the main Apache server).


B4J is NOT a standard for backend servers
B4J servers are based on Jetty which is a popular Java server.
B4J servers are very good and simple to use. Especially for B4X developers and especially as the backend to other B4X applications.

As I see it, if a developer is not familiar with PHP, then there is really no good reason to implement the backend with PHP unless they use a shared hosting and cannot use B4J.
 
Last edited:

ilan

Expert
Licensed User
Longtime User
unless they use a shared hosting and cannot use B4J

I think almost every developer use today a shared hosting server. They are cheap and simple to use.

I dont have enough knowledge to make my own server. I just dont understand much about servers. So i guess b4j serves wont run on hosted server because the hosted server dont support b4j language. So my question to you @Erel and all b4x members why no one have thought about buying some pcs and make a hosted shareds servers that support b4j servers and offer it for us users.

Instead of using other services we would use this option because it will support b4j and all other languages like php,...

So if you are very good fimiliar with servers this is a good oppurtinity for a business

You will have me as the 1st costumer.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
B4J servers do not run on most shared hosting because they do not provide shell access which is required in order to start the server.
(From my experience you should avoid using shared hosting for anything important. They are not reliable as all the sites share the same resources and they are also vulnerable to hacking.)

VPS hosting are also quite cheap. If you are not familiar with Linux then you can choose a Windows solution. You only need to copy the JRE package and configure Windows to run the server jar when it starts.
 

ilan

Expert
Licensed User
Longtime User
VPS hosting are also quite cheap. If you are not familiar with Linux then you can choose a Windows solution. You only need to copy the JRE package and configure Windows to run the server jar when it starts

Like the hosted mac server (b4i) ?

I really want to use b4j on my rp2 and have my own server where i can store my webpage but for me its like chinese.
I dont know where to start and how it works.

If there was a simple example that already works i could try it.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User

moster67

Expert
Licensed User
Longtime User
I have set up a few servers using VPS (personally I use DigitalOcean as provider - I am using a USD 5.00/month) and when setting things up, you just choose one with the desired Operating System. Most things are already set-up for you. You might thereafter need to install optional components for what you need but you can find plenty of guides how to do it by searching. I did not have any experience in the beginning but after a few installs I got the hang of it - you learn quickly.

Recently I set up a streaming server (that I had never heard of) and just followed the instructions provided and now it's up and running and working fine.

So the bottom-line is that it might seem intimidating at first but it really is not once you have done a few installations. In the beginning it is good to set up a server, add things, configure them and then remove all and start over - it is a good way of learning.

As Erel said, with shared hosting you are limited and there are many restrictions. Using a VPS you have a full server at your disposal. Once things are working fine, you can register a domain and/or point your existing domain to your new server.
 

AHilton

Active Member
Licensed User
Longtime User
So if you are very good fimiliar with servers this is a good oppurtinity for a business

You will have me as the 1st costumer.


I've thought about doing that in the past. I have about a dozen old Dell PowerEdge, HP/Cisco Proliant servers that I picked up at auction and refurbished; a nearly empty rack; a Gb/s fiber pipe to the internet and some experience with B4J servers, etc. to do it. But, as Erel pointed out, VPS's are pretty cheap these days. Besides, I'd rather program than admin servers (I hate when I have to admin even my own servers). If the margins were greater, I could see maybe hiring someone else to admin the whole thing, even part-time, but I really doubt there's that much demand. It's a volume business.
 

sorex

Expert
Licensed User
Longtime User
(From my experience you should avoid using shared hosting for anything important. They are not reliable as all the sites share the same resources and they are also vulnerable to hacking.)

actually this is the case for VPS aswell but at virtual machine level.

why is VPS so cheap? because it's not a dedicated server but a dedicated virtual machine. so the resources of the host are shared to the virtual machines.

but indeed, you get access to everything as if it was a dedicated machine and you get your fixed amount of cpu, memory and storage for it.

@AHilton :
I worked years with Dell PowerEdge servers, they are a dream to work with and extremely fast.
But indeed, if you start counting what comes next to your server it goes up quite fast (datacenter rack & power cost, provider cost, maybe license costs, ...)
You're better of with a VPS with good virtual specs.
 

tufanv

Expert
Licensed User
Longtime User

Can you suggest a quality vps you know ?
 

AHilton

Active Member
Licensed User
Longtime User


re: PowerEdge server ... I agree. And rock-solid machines that just keep on running. They're easy to work on/repair and parts are (still) quite easy to find (although pricey sometimes). The only downside is that they are power-hungry. If people look around, especially students building a lab or programmers needing some dedicated server to test/play with, these older servers can be found cheap and often just need a hard drive. Companies and governments are, basically, throwing them away to upgrade in order to get better hyperthreading and VPS densities for each physical server.

I started using hosted VPS many years ago but quickly outgrew them due to flexibility, costs (they were quite a bit more expensive then, especially for bandwidth) and, more importantly, my having control issues about my clients' data, ownership and some clients' demands of responsibility. So, it became cost-effective to build my own. Even more so, now I hope, because of how B4J servers can scale. But, the vast majority of programmers/developers don't need that and, I agree, a hosted VPS is the way to go.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…