Re: [Agavi-Users] Port Number

0 views
Skip to first unread message

Craig Fairhurst

unread,
Jan 15, 2010, 5:22:45 AM1/15/10
to us...@lists.agavi.org
Hi David

Bit of a delay in being able to look at this one again.
I can see the SERVER_PORT is correct in both var_dump($_SERVER) and phpinfo(), both values show the correct 10088 port number.


On 9 Dec 2009, at 12:00, <users-...@lists.agavi.org> <users-...@lists.agavi.org> wrote:

Send users mailing list submissions to
us...@lists.agavi.org

To subscribe or unsubscribe via the World Wide Web, visit
http://lists.agavi.org/mailman/listinfo/users
or, via email, send a message with subject or body 'help' to
users-...@lists.agavi.org

You can reach the person managing the list at
users...@lists.agavi.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of users digest..."


Today's Topics:

  1. Re: Port Number (David Z?lke)


----------------------------------------------------------------------

Message: 1
Date: Tue, 8 Dec 2009 19:24:00 +0100
From: David Z?lke <david....@bitextender.com>
Subject: Re: [Agavi-Users] Port Number
To: Agavi Users Mailing List <us...@lists.agavi.org>
Message-ID: <FEB9A921-1F49-44B7...@bitextender.com>
Content-Type: text/plain; charset="us-ascii"

In your Apache config, you need to adjust ServerName as well, changing  
Listen alone is not enough, as you may also see when calling phpinfo()  
or dumping $_SERVER - SERVER_PORT will not be 10088 until your config  
is correct.

Obviously not an Agavi issue, then, and I'm not quite sure why you're  
fiddling with the Agavi source - the framework has built-in mechanisms  
to cover such situations (e.g. when running behind a load balancer,  
where the host and/or port need to be defined manually or be pulled  
from certain magic HTTP headers).

- David


On 08.12.2009, at 12:58, Craig Fairhurst wrote:

Hi

I'm having problems with $ro->getBaseHref() in my local environment
(using 1.0.2-RC2)
The port is set to 10088 and this isn't being picked up on.

I've resorted to modifying the Agavi installation to always return
10088 for now until it can be fixed.

Any advice appreciated.

_______________________________________________
users mailing list
us...@lists.agavi.org
http://lists.agavi.org/mailman/listinfo/users


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2439 bytes
Desc: not available
Url :
http://lists.agavi.org/pipermail/users/attachments/20091208/abcda737/attac
hment-0001.bin

------------------------------

_______________________________________________
users mailing list
us...@lists.agavi.org
http://lists.agavi.org/mailman/listinfo/users


End of users Digest, Vol 38, Issue 3
************************************

Craig Fairhurst


This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. Youds Media, 1a New Market St, Clitheroe Lancashire BB7 2JW http://youds.com

Craig Fairhurst

unread,
Jan 15, 2010, 5:46:18 AM1/15/10
to us...@lists.agavi.org
My apologies, seems "apachectl" in ZendServer CE doesn't restart the process properly.
Setting "ServerName" directive to "localhost:10088" did solve the problem, after a reboot.

Thanks

Mahmood reza Delfieh

unread,
Jan 16, 2010, 3:49:59 PM1/16/10
to Agavi Users Mailing List

Hello

 

Gow can I count numbers of online users?

 

Best Regards

Mahmood

 

Michal Charemza

unread,
Jan 18, 2010, 11:23:30 AM1/18/10
to Agavi Users Mailing List
I imagine there are a few different ways. A naive way would be:

- Have a database table "OnlineUsers": with "id" and "time" fields
- In your User class, in the initialize method either
  - Insert a new row to the table, and store the ID in the session (as a User attribute)
  - If there is already an ID in the session, update the row with the ID with the current time

Then, in a slot, you could query the database to find out how many people have looked at a page in the last X minutes, to get the number of online users.

*However*, this would mean 2 database requests per page load. So you could

- Use caching on the slot, with a lifetime of X minutes
- Also store "time" in session, and then only update the time in the database if the last page load time by that user was more than X minutes ago.

Michal.


Simon Cornelius P Umacob

unread,
Jan 18, 2010, 12:58:33 PM1/18/10
to Agavi Users Mailing List
Try this command to print out the number of established connections to
port 80 (i.e., your webserver)

netstat -an | grep "ESTABLISHED" | grep ".80 " | awk '{print $5}' |
sed 's/\([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*\)\.[0-9]*/\1/' | uniq | wc -l

Since browsers tend to open multiple connections at once, I've
filtered out repeated lines so that they will only count as a single
connection. The number might not be accurate if many of your users
are sitting behind NAT.

I've only tested this FreeBSD, but it should work with other Unix and
Linux distros as well...

[ simon.cpu ]

Simon Cornelius P Umacob

unread,
Jan 18, 2010, 1:06:44 PM1/18/10
to Agavi Users Mailing List
Before I sleep... note that netstat -a | grep http is more reliable.
grepping for ".80" doesn't guarantee that it'll match port 80.

[ simon.cpu ]

Michal Charemza

unread,
Jan 18, 2010, 1:16:40 PM1/18/10
to Agavi Users Mailing List
A cunning method. But I am curious:

- How long would a connection remain established? Once everything from a page has downloaded, is the connection closed? (I ask as although this would definitely show an accurate how many connections the server has, this might not be a useful figure. I assumed "how many users viewed a page in the last X minutes" is actually what is being asked for. )

- On a shared server, would this count *all* connections to all sites?

Michal.

Mathias Böttcher

unread,
Jan 18, 2010, 4:51:40 PM1/18/10
to Agavi Users Mailing List
Mahmood,

please send a new mail if you would like to post a new question! If you
answer to another mail and change its subject, you break the complete
discussion thread. You can see this symptom here:

http://groups.google.com/group/agavi-users/browse_thread/thread/f8ec7f6c9ca766c8

Craig dropped the first two mails regarding a port problem. You answered
the second mail and whoops the subject changed completly.

Thx and best regards, Mathias

Simon Cornelius P Umacob

unread,
Jan 19, 2010, 12:47:47 AM1/19/10
to Agavi Users Mailing List
On Tue, Jan 19, 2010 at 2:16 AM, Michal Charemza
<michalc...@gmail.com> wrote:
> A cunning method. But I am curious:
>
> - How long would a connection remain established? Once everything from a page has downloaded, is the connection closed? (I ask as although this would definitely show an accurate how many connections the server has, this might not be a useful figure. I assumed "how many users viewed a page in the last X minutes" is actually what is being asked for. )
>

Once the page has been displayed, the socket is still open and goes to
FIN_WAIT_2 state (which you can grep from netstat) until the server
closes it. Clients are supposed to acknowledge the server in order to
close it, but some buggy clients don't.

I dunno exactly how long the connection is kept open... I think it's
dependent on the web server's keep-alive timeout value.

There's also an OS-specific value for FIN_WAIT_2, which can be set via
sysctl. In my FreeBSD box, sysctl -a net.inet.tcp | grep
finwait2_timeout gives me:

net.inet.tcp.finwait2_timeout: 60000

YMMV....

> - On a shared server, would this count *all* connections to all sites?

LOL... I've never thought of that. Yes, it'll count the connections
for all sites.... Maybe we can just grep the server's log file for
HTTP GET requests so that we can have a generic counter or
something...

Reply all
Reply to author
Forward
0 new messages