[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: [mv] using too much memory
****** message to minivend-users from Mike Heins <mikeh@minivend.com> ******
Quoting Held Gabor (held@egon.gyaloglo.hu):
>
>
> Hi!
>
> I am using the Minivend 4.03 version.
>
> Every request of a Minivend-page needs more than 12 MBs of RAM. I think
> it's too much. If I have 10-15 visitors at the same time, the system falls
> down.
>
> I tried it with the default (basic) database. It's small and uses the
> simple text search.
>
> Can somebody help me?
> What can I do to spare memory and avoid system breakdowns?
>
> I have Perl 5.005, 128 MB RAM
Sorry, there is nothing to be done. There shouldn't be system breakdowns,
though. MV will limit the number of processes to a manageable number via
MaxServers. (Except on BSD. Even then, you can set SOMAXCONN to a manageable
number and get some rate limiting.)
In actual practice, Minivend seems to be able to handle fairly high
loads reliably. On a moderately fast machine (say 300MHz) it should be
able to handle 250 requests per minute without breathing too hard. That
is quite a few visitors.
Performance problems can often be traced to the laws of physics; making
too many database requests or too many tag parses in a page. Unrolling
a loop into a single embedded Perl routine can increase performance by
orders of magnitude.
This kind of thing is nice to use nowadays:
[query arrayref=my_query
sql="select sku,description,title,artist,price from products"][/query]
[mvasp]
<%
my $products = $Tmp->{my_query};
my ($sku, $description, $title, $artist, $price) = (0 .. 4);
foreach $line (@$products) {
HTML "<B>$line->[$sku]</B> ";
HTML "<I>$line->[$description]</I>";
}
%>
[/mvasp]
To templatize a bit more, you can do:
[mvasp]
<TABLE>
<%
my $products = $Tmp->{my_query};
my ($sku, $description, $title, $artist, $price) = (0 .. 4);
foreach $line (@$products) {
%>
<TR>
<TD>
<%= $line->[$sku] %>
</TD>
<TD>
<%= $line->[$description] %>
</TD>
</TR>
<%
}
%>
</TABLE>
[/mvasp]
It is quite fast. You do one database select and two tag parses. If you
want to see an example of an application that does this (on a server
which serves that 250 requests per minute routinely without going over
a 1 load average) you can look at:
http://www.freecell.com/way/cool/cell/scores.html
No torture tests, please. This is a live server.
If you need more capacity, you can add more machine and/or more memory. A
server pair works very well; one to serve HTTP for images and static pages, one
to serve MV. They can communicate via tlink and a private ethernet. I use that
system myself to handle many more requests than that. It seems to insulate you
from the peaks that you get running HTTP and MV on the same system.
For scalability, you can actually split Minivend over more than one machine;
sharing databases and sessions via the network. I have been able to demonstrate
the ability to handle peak loads of 80 requests per second and sustained loads
of 50 per second using two machines.
I have never claimed that Minivend is lightweight. But I will claim that it can
be made to perform in the real world. 8-)
--
Internet Robotics, 131 Willow Lane, Floor 2, Oxford, OH 45056
phone +1.513.523.7621 fax 7501 <mikeh@minivend.com>
Friends don't let friends use Outlook. -- Bob Blaylock
-
To unsubscribe from the list, DO NOT REPLY to this message. Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list