Jump to content

dlublink

Members
  • Posts

    14
  • Joined

  • Last visited

    Never

Everything posted by dlublink

  1. Hello, Can I set the priority on my scripts relating to swap? Something like set_swap(10); would mean that it will be first to go into swap and set_swap(1) means it will go as a last resort and set_swap(5) being the default ? Kind of like the proc_nice() but for memory ? Thanks, David
  2. Hello, So I am trying to reduce my memory footprint to the lowest possible value without sacrificing functionality. I noticed that if I write a comment that is 2kb long, it costs me 2kb more memory to run the script. How can I get PHP to free the memory taken up by comments? It seems like it would be a real pain in the butt to have to run php -w on all my source files each time I update my server. Any ideas? Thanks. David
  3. Having a 64-bit OS would cause PHP's memory consomption to double?!??! I was using memory_get_usage() not memory_get_peak_usage(). On both machines the difference is about 200,000 bytes ( between memory_get_usage and memory_get_peak_usage ). The production ( 64bit ) machines use about 15 megabytes and the development ( 32bit ) machine is at about 8.5 megabytes. I am convinced there is something else going on, it does not make sense to me that there is such a large difference in memory consomption. David
  4. Hello, I have three "servers". 2 machines with 64-bit dual processor, 12 cores, 24 threads at 2.80GHz each. 8 gigs of memory each and a bunch of disks. 3 SATA 10,000k disks in raid 1 with hot spare each. We'll call these two "production" I have a third machine P4 2.40GHz with 500 megabytes of memory and a 8gig ide disk. We'll call this one "development" Both are running php5 under lighttpd fast cgi and APC. Here's the mystery, both have exactly the same code ( synched with svn ). On the production machines, the reference page takes 16megabytes of memory. On the development machine, the same reference page takes 8 megabytes. I have run the test several times. I am using the same database ( mysqldump ) on both machines. Why are the production machines taking twice as much memory as the development machine ? Production machines are running cracklib mod and 3rd machine is running xdebug. I disabled both so they'd be the same. Still have the difference. I did an phpinfo() on both machines. The differences were with the xdebug and cracklib libraries ( which I reenabled before the phpinfo()), server name, IP. I disabled apc cache on both machines, thinking this was my problem, the memory consomption stays the same. What is causing such a big difference in memory consomption? Is there a cachegrind for memory usage ? Any ideas where to look? Ubuntu 10.04 LTS is the O/S Thanks, David
  5. A title for each post is maybe a bit exagerated, but I think that the ability to modify the original topic would be good. David
  6. Ok, so after a day of frustrations, I did the following test : On Ubuntu 8.04 : nc mycoolip 5000 -u On Ubuntu 10.04 : nc mycoolip 5000 -u On ( another ) Ubuntu 10.04 : nc 5000 -u -l Messages sent from 10.04 appear on the listening nc, and from 8.04 do not. Therefore this issue is NOT PHP related. I'll post back if I ever figure out why this isn't working.
  7. I installed PHP 5.2.4 on Ubuntu 10.04, and the packets go through anyway. It would seem the issue is OS related.
  8. I setup a daemon using xinetd, and the received packets are doing the same thing. So the problem seems to be with the packets being sent.
  9. Hello, I think that the topic/subject of a thread should always be editable by the original author ( perhaps not the entire message, but just the topic ) I did in fact read the note about you deleting/editing posts, and I agree with your reasoning. However, as a thread evolves, ( a well written topic ) may need updating. For example, in this thread : http://www.phpfreaks.com/forums/index.php/topic,303661.0.html As I did further research, it would seem the problem might be from the sending and not the receiving end. I could update the topic/subject so that is reflects the latest findings, this could be good for users who often do more research after posting a message to the boards. The other option might be to give each post a topic, and show the last topic with the first topic in the forum view, this could be even better. This could give the forum list reader more information about the current position of the discussion. Thanks, David
  10. After doing some packet sniffing, I found no difference ( other than the IP ) between the two packets. I did notice however that if the local PHP script was NOT running, an ICMP packet was being sent out saying the port was not available. Funny enough, it was only being sent in reply to the server that PHP can receive the UDP packets from. So I think the bug might be in the actual sending of the packets. But I use the same server to send UDP packets to Kamailio datagram MI interface with no problem. So why would it work with Kamailio but not with PHP ? I am using the code the same code on both machines. Here is the test code to send it ( it's a PHP.net example + while loop ) : $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); $msg = "Ping !"; $len = strlen($msg); while ( socket_sendto($sock, $msg, $len, 0, 'my.cool.ip.is.hidden.here', 5000 ) ) sleep(1);
  11. I think the problem might be OS related, because when it is sent from Ubuntu 10.04 to Ubuntu 10.04 it works fine, from Ubuntu (7|.04 to 8.04 it works fine. But between the two, it doesn't work. I am going to see if I can find a difference in the actual packets
  12. Using the example on this page : http://ca3.php.net/stream_socket_server <?php $socket = stream_socket_server("udp://127.0.0.1:1113", $errno, $errstr, STREAM_SERVER_BIND); if (!$socket) { die("$errstr ($errno)"); } do { $pkt = stream_socket_recvfrom($socket, 1, 0, $peer); echo "$peer\n"; stream_socket_sendto($socket, date("D M j H:i:s Y\r\n"), 0, $peer); } while ($pkt !== false); ?> If the message is sent from the same subnet, this script works fine, I see the output of the message. But if the message is from a remote system ( different subnet ), the script does nothing, even though I see the UDP packet coming in using ngrep. Is there some kind of IP restriction in effect? It does this to me on PHP 5.3 and PHP 5.2.6, running on Ubuntu 10.04, Ubuntu 8.04 and Ubuntu 7.04. The only thing I changed when I copied the script is I replaced "127.0.0.1" with my public IP address. ( not 10.x.x.x, 192.168.x.x or 172..., a proper unnatted public IP ) Any ideas what might cause the message not to be received? Thanks, David
  13. I want to share objects between the children processes and the parent. So I wrote this simple code to illustrate what I want to do : $obj = new Cool() ; $obj->ping(); $pid = pcntl_fork(); if ($pid == -1) { die('could not fork'); } else if ($pid) { // we are the parent pcntl_wait($status); //Protect against Zombie children $obj->ping(); } else { $obj->ping(); // we are the child } Class Cool { private $pong = 0; public function __construct() { } public function ping() { echo $this->pong++ ."\n"; } } ( This code was taken from http://ca.php.net/manual/en/function.pcntl-fork.php with a small modification to illustrate my need ). Here is my phpinfo() here is the output As you can see, this PHPinfo is taken from my development server, not production. So, how do I get the pings to count 012 instead of 011 ? Thanks, David
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.