AS Extensions problem

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

pichikala
Posts: 8
Joined: 12 Apr 2014, 17:31
Location: israel
Contact:

AS Extensions problem

Postby pichikala » 02 Apr 2016, 23:56

Hi,
In my server-side, I using in php files to save the data on the database.
I bought 100 users online license because my game got more popular.
Now, alot of users got bugs because of load the php files.
One user sends request to load his items while other user load it too, and the server-side confused and sends to the user information that do not belong to him, and the information belong to other user.
It happend also in login request, if user connect to the server while admin user connect, the server-side gives him the admin variables.

Link for my game: http://play-omega.com/

Sorry for my english.. :?
User avatar
Lapo
Site Admin
Posts: 23025
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: AS Extensions problem

Postby Lapo » 04 Apr 2016, 07:36

Hi,
I think it would be easier to directly call the database from your Extension code instead of delegating a web-server with PHP. This is because every HTTP call must run in a different thread and it also adds quite a bit of overhead in terms of latency etc...

Is there a specific reason why you can't directly talk to the database from your Extension avoiding the middle man? (i.e. the HTTP call toward the PHP server?)
Is your DB machine running in the same network with server running SmartFox?

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
pichikala
Posts: 8
Joined: 12 Apr 2014, 17:31
Location: israel
Contact:

Re: AS Extensions problem

Postby pichikala » 06 Apr 2016, 16:54

Thanks for your reply,
I was used in PHP because I never knew about the database system on the server-side.
Now I know, and I know how to use it, but I have a lot of codes on PHP and I can't to change all my code.
Why did the server makes problems with this?
pichikala
Posts: 8
Joined: 12 Apr 2014, 17:31
Location: israel
Contact:

Re: AS Extensions problem

Postby pichikala » 06 Apr 2016, 18:02

I tried the database system and it very slowly. Is this just in my test server or it will be like that when I upload it on the server?
User avatar
Lapo
Site Admin
Posts: 23025
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: AS Extensions problem

Postby Lapo » 07 Apr 2016, 09:10

pichikala wrote:Thanks for your reply,
I was used in PHP because I never knew about the database system on the server-side.
Now I know, and I know how to use it, but I have a lot of codes on PHP and I can't to change all my code.
Why did the server makes problems with this?


The problem is that there is a lot of latency. You have to call a web server using HTTP which is slower than a direct socket connection, plus the HTTP server has to talk to the database which adds another layer of latency.
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Lapo
Site Admin
Posts: 23025
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: AS Extensions problem

Postby Lapo » 07 Apr 2016, 09:11

pichikala wrote:I tried the database system and it very slowly. Is this just in my test server or it will be like that when I upload it on the server?

When you say you "tried the database system" you mean you tried to connect from your Extension code?

What does it mean that it is slow? Did you measure the latency?
Also you didn't answer my previous question ---> Is your DB machine running in the same network with server running SmartFox?

thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
pichikala
Posts: 8
Joined: 12 Apr 2014, 17:31
Location: israel
Contact:

Re: AS Extensions problem

Postby pichikala » 07 Apr 2016, 10:48

Hi,
I mean I tried to connect from my Extension code.

When I said slow, I mean that the server reply after few sec.

My DB machine is running on my hosting server.
User avatar
Lapo
Site Admin
Posts: 23025
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: AS Extensions problem

Postby Lapo » 07 Apr 2016, 12:52

pichikala wrote:Hi,
I mean I tried to connect from my Extension code.

When I said slow, I mean that the server reply after few sec.

My DB machine is running on my hosting server.

What I am asking is if your SmartFox instance and database are running in the same network (or the same machine)
That's the only way in which you can obtain proper speed.

From the description of your problem it sounds like the two machines are communicating via the internet as opposed to a local network, which is the main cause of the latency.
Lapo

--

gotoAndPlay()

...addicted to flash games
pichikala
Posts: 8
Joined: 12 Apr 2014, 17:31
Location: israel
Contact:

Re: AS Extensions problem

Postby pichikala » 07 Apr 2016, 17:16

Thank you Lapo!
I will try it.
pichikala
Posts: 8
Joined: 12 Apr 2014, 17:31
Location: israel
Contact:

Re: AS Extensions problem

Postby pichikala » 08 Apr 2016, 11:38

Hi,
How can I make DB on my VPS?
User avatar
Lapo
Site Admin
Posts: 23025
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: AS Extensions problem

Postby Lapo » 08 Apr 2016, 13:50

It really depends on the type of VPS and the database you need to install and it's pretty difficult for us to provide generic hosting help, as it is beyond the scope of our support forum.

Maybe the people at your hosting provider can install it for you, which I would recommend if you don't have experience with these things.

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
pichikala
Posts: 8
Joined: 12 Apr 2014, 17:31
Location: israel
Contact:

Re: AS Extensions problem

Postby pichikala » 08 Apr 2016, 21:16

Okay. Thank you very much for your quick responses!

Return to “SmartFoxServer 1.x Discussions and Help”

Who is online

Users browsing this forum: No registered users and 40 guests