shell

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

shell

Post by ol4pr0 »

Oke wondering the following.

I am thinking of replacing some of the code that are now on the webpage itself and put it on the shell.

Now would there be a significant change in speed?
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Post by Roja »

I'll be as specific as you were: "Maybe".

:)

Seriously, it depends on the code, how you are "moving" it to the "shell", what the server is like... dozens of factors.
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

meaning

shell_exec("params") ; :)
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Post by Roja »

ol4pr0 wrote:meaning

shell_exec("params") ; :)
Thats one.. you left out..
Seriously, it depends on the code, how you are "moving" it to the "shell", what the server is like... dozens of factors.
I mean, if you are doing ECHO, no, running it on the server isnt going to be faster. Show some examples of what you are doing, and we can suggest some optimizations or at least give you an idea of whether it would be faster "on the shell".

Further, if the server is heavily loaded (cpu/memory), dropping it to shell may actually be SLOWER than running it from php, since it has to fork a new process.
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

No i wasnt aming on some echo s hehe..

that would be rather dumb.

talking here about

I/O and MAIL and even some of the db queries ( not that need to be there but, better to do it all in one run then having it return something and than let php do the rest.

i am not worried about the server, which is rather fast (UNIX). The thing is that here most people have a connection which is like maximum 6kb.

So what i am trying to is to try making things go smoother ( or look like they run smoothly ) by executing some of them things on the shell itself.
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Post by Roja »

You'd really have to post code to get a specific answer.

Almost everything you list might be faster on the commandline, or might not.

As always, its best to benchmark where the real problems are using a benchmark class, and determine what portions you need to improve.

Then, take that section of code, and ask for help with it.

You never know what little optimizations you havent thought of that could save you almost 50% - it happened to me!

But beyond that, if you truly want to try moving those sections of code to the shell, then do so - one at a time, and benchmark the time in php, and then running in exec by php.

Also, since you mentioned dialup users, are you using output buffering and gzip compression? Both help immensely with dialup users.

Also, use HTML-compliant code, which helps the display render faster.

There are many suggestions that can be made on how to make things "go smoother" for you, but you've given very little information and asked a very specific question.

The answer is maybe. Your best specific answer will come from specific code, benchmarks, and testing.
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

Actually those dail up users hehe, are on "BROADBAND" cable ( atleast thats what they like to call and try to make us believe hehe.

Sorry i cant give u code, not that i dont want to but.. ohwell. u have a pretty good idea :)

Its that i thought, that since i dont need a return i can bypass the process by running it in a bash and just continue to the next page ( so have it run on the background while the pages (website) continues.

However the GZIP u were talking about. i am interested to hear more about that and what it is that u mean with that.
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

Got it the GZIP that is and its benefit.

Thanks :)
Post Reply