473,385 Members | 1,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

simple multiuser considerations

Hi everyone,
Managing sessions and cookies looks simple if you go by the varied
tutorials on the web. But I have a few questions about real multiuser
issues which i could not get any tutorials on:

1)say, I have a page doesalot.php on http://www.mysite.com/ which will
be accessed by say 50 users at a time. Then, my session id checking
script must run 50 instances, one for each user and the appropriate
database table must, at the end of that time, get 50 rows, one for each
session (of course, i've written the db insert code into the page right
at the top). Does this happen by default or do I have to set something
in php.ini or anywhere else or worse, take care of it in the script by
checking for IP via $_SERVER['REMOTE_ADDR'] etc.

2) If it is just 5-10 users per second maybe it will not be a problem,
but a worst-case load of say 50-100 requests per second will definitely
be an issue (assuming my host has given me enough bandwidth). Is there
some setting for such tuning?

It'll be great if someone could point me to a site or tutorial that
deals with these issues.

Thanks in advance,
Regards,
Joseph S.

Sep 29 '05 #1
4 1534
Joseph S. wrote:
Hi everyone,
Managing sessions and cookies looks simple if you go by the varied
tutorials on the web. But I have a few questions about real multiuser
issues which i could not get any tutorials on:

1)say, I have a page doesalot.php on http://www.mysite.com/ which will
be accessed by say 50 users at a time. Then, my session id checking
script must run 50 instances, one for each user and the appropriate
database table must, at the end of that time, get 50 rows, one for each
session (of course, i've written the db insert code into the page right
at the top). Does this happen by default or do I have to set something
in php.ini or anywhere else or worse, take care of it in the script by
checking for IP via $_SERVER['REMOTE_ADDR'] etc.

2) If it is just 5-10 users per second maybe it will not be a problem,
but a worst-case load of say 50-100 requests per second will definitely
be an issue (assuming my host has given me enough bandwidth). Is there
some setting for such tuning?

It'll be great if someone could point me to a site or tutorial that
deals with these issues.


Take a look into session_set_save_handler:
http://us2.php.net/manual/en/functio...ve-handler.php

You may find something that will save you a lot of time.

--
Justin Koivisto, ZCE - ju****@koivi.com
http://koivi.com
Sep 29 '05 #2
Let me rephrase my question,

If i have a page dosomething.php which three users situated at
geographically diverse locations are simultaneously viewing, and if I
use
$_SESSION['x']=$_GET['x'];
or some such code,
then,
are there, in the server machine's RAM, totally three different
$_SESSION['x'] variables with their respective values or is there just
one?

I looked up and found (send win enabler white paper) that the CGI
installation of PHP under Apache,Windows works like that - there is "a
separate process initiated" for each request of the dosomething.php
page and apparently (not clearly stated) not the apache module version
of PHP.

It also says that php on apache 1.3 on Unix (or linux) uses a
multiprocess webserver - meaning one process for each request.

I have a WinXP machine for development and will be deploying to a host
that has PHP and MySQL on Apache on Linux.

Will that setup be <one request one $_SESSION['x'] variable> ?

***************
Also, does the code have to be written in a different way for LAMP than
for WAMP(apachemodule, not CGI) or does it automatically understand so
and behave thread safe?
In other words, do I have to do anything else to my $_SESSION['x'] =
$_GET['x'] for the code to work on LAMP after seeing it run properly on
my single user WAMP development setup?
***************

Thanks in advance.
Joseph S.

Sep 30 '05 #3
"Joseph S." <js****@rediffmail.com> wrote:

Let me rephrase my question,

If i have a page dosomething.php which three users situated at
geographically diverse locations are simultaneously viewing, and if I
use
$_SESSION['x']=$_GET['x'];
or some such code,
then,
are there, in the server machine's RAM, totally three different
$_SESSION['x'] variables with their respective values or is there just
one?
There will, of course, be three separate session data structures, and three
separate instances of $_SESSION['x']. That is the entire point of using
sessions -- to distinguish between different users.
I looked up and found (send win enabler white paper) that the CGI
installation of PHP under Apache,Windows works like that - there is "a
separate process initiated" for each request of the dosomething.php
page and apparently (not clearly stated) not the apache module version
of PHP.
Well, sort of; *every* CGI request, regardless of the language, starts up a
new process. When the request has been handled, the process ends
(usually). The session stuff has to be put in a store somewhere so that it
does not evaporate.
Will that setup be <one request one $_SESSION['x'] variable> ?
Always.
Also, does the code have to be written in a different way for LAMP than
for WAMP(apachemodule, not CGI) or does it automatically understand so
and behave thread safe?
In other words, do I have to do anything else to my $_SESSION['x'] =
$_GET['x'] for the code to work on LAMP after seeing it run properly on
my single user WAMP development setup?


No.
--
- Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Oct 2 '05 #4
Thanks, Tim. Your reply was very helpful, cleared all the doubts. I'm
doing a small project for a company. The advice is invaluable.

Regards,
Jospeh S.

Oct 3 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: nephish | last post by:
Hey there, i have been spending some time learning python. i do enjoy it so. Heres the deal. i need some dirrection advice. i have a friend that wants me to set up a customer database for him....
1
by: Howie | last post by:
Hi, i need a simple multiuser access to a file for parameters like increment numbers. The numbers are needed for order-numbers etc. They should be incremented by every programm (client) on an...
0
by: Leszek Dubiel | last post by:
----------------------------------------- BACKGROUND In my company (www.glass.biz) we use ERP software to compute what has to be done to do products for our customers. Main algorithm takes data...
0
by: Ketchup Kerry | last post by:
I wrote a multithreaded windows service that has read/write access to an XML file using a mutex. I started wondering -- a multiuser XML file could be really useful in cases where a small,...
0
by: Caesare Gentile | last post by:
Suppose I want to write a webservice, where an XML file is loaded in XmlDocument and then a web method is built that would take in an XPath query as a parameter, and a string value. The Xpath...
1
by: John Bailo | last post by:
C# Corner ( http://csharpcorner.com ) is running my article: "Multiuser XML 'Database' Web Service" Thanks to everyone in these newsgroups who gave me help and advice when presenting the...
0
by: Durai | last post by:
Hello All, How to test the "Multiuser testing" in PostgreSQL?. I used the apache bench "ab" tool for this one. The following command execute the "test.php" 50 times concurrently. $ ab -c 1...
0
by: s | last post by:
I need to develop a multiuser database application to be used by four people(The number of users are not likely to increase). It is for storing records of different versions of particular papers. I...
0
by: raamay | last post by:
I am new to VB.Net but since i have a good experience in VB6(having developed 2 to 3 desktop applications), i find no problem coping with the new environment at this stage. Well, i am planning to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.