My squid is slower than apache

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

My squid is slower than apache

程卫星
I use apache 2.0.59 and squid 2.6.STABLE13, and test with apache's ab command:
ab -n 100000 -c 50 http://***/header.jpg
When use apache only, the result is:
--------------------
Concurrency Level:      50
Time taken for tests:   2.805669 seconds
Complete requests:      10000
Failed requests:        0
Write errors:           0
Total transferred:      325499626 bytes
HTML transferred:       321909602 bytes
Requests per second:    3564.21 [#/sec] (mean)
Time per request:       14.028 [ms] (mean)
Time per request:       0.281 [ms] (mean, across all concurrent requests)
Transfer rate:          113295.61 [Kbytes/sec] received
-------------------------
When use squid with apache, test result is:
-------------------------
Concurrency Level:      50
Time taken for tests:   3.739039 seconds
Complete requests:      10000
Failed requests:        0
Write errors:           0
Total transferred:      326745046 bytes
HTML transferred:       322174102 bytes
Requests per second:    2674.48 [#/sec] (mean)
Time per request:       18.695 [ms] (mean)
Time per request:       0.374 [ms] (mean, across all concurrent requests)
Transfer rate:          85339.04 [Kbytes/sec] received
------------------------------
So my question is: why squid is slower than apache? Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: My squid is slower than apache

Jose Celestino
Words by 程卫星 [Thu, Jul 19, 2007 at 11:07:32PM +0800]:

>  I use apache 2.0.59 and squid 2.6.STABLE13, and test with apache's ab command:
>  ab -n 100000 -c 50 http://***/header.jpg
>  When use apache only, the result is:
>  --------------------
>  Concurrency Level:      50
>  Time taken for tests:   2.805669 seconds
>  Complete requests:      10000
>  Failed requests:        0
>  Write errors:           0
>  Total transferred:      325499626 bytes
>  HTML transferred:       321909602 bytes
>  Requests per second:    3564.21 [#/sec] (mean)
>  Time per request:       14.028 [ms] (mean)
>  Time per request:       0.281 [ms] (mean, across all concurrent requests)
>  Transfer rate:          113295.61 [Kbytes/sec] received
>  -------------------------
>  When use squid with apache, test result is:
>  -------------------------
>  Concurrency Level:      50
>  Time taken for tests:   3.739039 seconds
>  Complete requests:      10000
>  Failed requests:        0
>  Write errors:           0
>  Total transferred:      326745046 bytes
>  HTML transferred:       322174102 bytes
>  Requests per second:    2674.48 [#/sec] (mean)
>  Time per request:       18.695 [ms] (mean)
>  Time per request:       0.374 [ms] (mean, across all concurrent requests)
>  Transfer rate:          85339.04 [Kbytes/sec] received
>  ------------------------------
>  So my question is: why squid is slower than apache? Thanks.

Choose one or both of:

1. Because squid is misconfigured.
2. Because your test is biased.

--
Jose Celestino
----------------------------------------------------------------
http://www.msversus.org/     ; http://techp.org/petition/show/1
http://www.vinc17.org/noswpat.en.html
----------------------------------------------------------------
"And on the trillionth day, Man created Gods." -- Thomas D. Pate
Reply | Threaded
Open this post in threaded view
|

Re: My squid is slower than apache

程卫星
In reply to this post by 程卫星
Yes, Squid request status in access log is TCP_HIT:NONE.
Squid and apache run on same server, and apache ab command runs on
another server.

2007/7/20, Marcos Camões Bourgeaiseau <[hidden email]>:

> Are you sure the test page was already in the squid cache? If it was
> not, you have answer , as squid had to fetch the page in your apache serve.
> Try the test again and see the results.
> By the way, the servers have the same hardware configuration and similar
> performance?
>
> 程卫星 wrote:
> > I use apache 2.0.59 and squid 2.6.STABLE13, and test with apache's ab
> > command:
> > ab -n 100000 -c 50 http://***/header.jpg
> > When use apache only, the result is:
> > --------------------
> > Concurrency Level:      50
> > Time taken for tests:   2.805669 seconds
> > Complete requests:      10000
> > Failed requests:        0
> > Write errors:           0
> > Total transferred:      325499626 bytes
> > HTML transferred:       321909602 bytes
> > Requests per second:    3564.21 [#/sec] (mean)
> > Time per request:       14.028 [ms] (mean)
> > Time per request:       0.281 [ms] (mean, across all concurrent requests)
> > Transfer rate:          113295.61 [Kbytes/sec] received
> > -------------------------
> > When use squid with apache, test result is:
> > -------------------------
> > Concurrency Level:      50
> > Time taken for tests:   3.739039 seconds
> > Complete requests:      10000
> > Failed requests:        0
> > Write errors:           0
> > Total transferred:      326745046 bytes
> > HTML transferred:       322174102 bytes
> > Requests per second:    2674.48 [#/sec] (mean)
> > Time per request:       18.695 [ms] (mean)
> > Time per request:       0.374 [ms] (mean, across all concurrent requests)
> > Transfer rate:          85339.04 [Kbytes/sec] received
> > ------------------------------
> > So my question is: why squid is slower than apache? Thanks.
> >
>
> --
> Marcos Camões Bourgeaiseau - KIKO
> e-mail normal: [hidden email]
> e-mail para anexos grandes: [hidden email]
>
Reply | Threaded
Open this post in threaded view
|

Re: My squid is slower than apache

Adrian Chadd
On Fri, Jul 20, 2007, ?????? wrote:
> Yes, Squid request status in access log is TCP_HIT:NONE.
> Squid and apache run on same server, and apache ab command runs on
> another server.

Well, that means Squid is hitting apache on the same server for
every request from ab?



Adrian

K K
Reply | Threaded
Open this post in threaded view
|

Re: My squid is slower than apache

K K
In reply to this post by 程卫星
I'd recomend trying a different testing tool, one that can display
min/median/max response time, rather than just the mean.  One such
tool is httperf.

On 7/19/07, 程卫星 <[hidden email]> wrote:
> Yes, Squid request status in access log is TCP_HIT:NONE.

Why TCP_HIT instead of TCP_MEM_HIT?

KK
Reply | Threaded
Open this post in threaded view
|

Re: My squid is slower than apache

程卫星
In reply to this post by Adrian Chadd
TCP_HIT means a valid copy of the requested object was in the cache.
Apache received less than 30 request.

2007/7/20, Adrian Chadd <[hidden email]>:

> On Fri, Jul 20, 2007, ?????? wrote:
> > Yes, Squid request status in access log is TCP_HIT:NONE.
> > Squid and apache run on same server, and apache ab command runs on
> > another server.
>
> Well, that means Squid is hitting apache on the same server for
> every request from ab?
>
>
>
> Adrian
>
>


--
程卫星 13331170582
Reply | Threaded
Open this post in threaded view
|

Re: My squid is slower than apache

程卫星
In reply to this post by 程卫星
My squid setting:
cache_mem 1536 MB
maximum_object_size_in_memory 1024 KB

Is this misconfigured?

2007/7/20, gogo407 skine <[hidden email]>:

>
>
> 2007/7/20, 程卫星 <[hidden email]>:
> > Yes, Squid request status in access log is TCP_HIT:NONE.
> > Squid and apache run on same server, and apache ab command runs on
> > another server.
> >
> > 2007/7/20, Marcos Camões Bourgeaiseau < [hidden email]>:
> > > Are you sure the test page was already in the squid cache? If it was
> > > not, you have answer , as squid had to fetch the page in your apache
> serve.
> > > Try the test again and see the results.
> > > By the way, the servers have the same hardware configuration and similar
> > > performance?
> > >
> > > 程卫星 wrote:
> > > > I use apache 2.0.59 and squid 2.6.STABLE13, and test with apache's ab
> > > > command:
> > > > ab -n 100000 -c 50 http://***/header.jpg
> > > > When use apache only, the result is:
> > > > --------------------
> > > > Concurrency Level:      50
> > > > Time taken for tests:   2.805669 seconds
> > > > Complete requests:      10000
> > > > Failed requests:        0
> > > > Write errors:           0
> > > > Total transferred:      325499626 bytes
> > > > HTML transferred:       321909602 bytes
> > > > Requests per second:    3564.21 [#/sec] (mean)
> > > > Time per request:       14.028 [ms] (mean)
> > > > Time per request:       0.281 [ms] (mean, across all concurrent
> requests)
> > > > Transfer rate:           113295.61 [Kbytes/sec] received
> > > > -------------------------
> > > > When use squid with apache, test result is:
> > > > -------------------------
> > > > Concurrency Level:      50
> > > > Time taken for tests:   3.739039 seconds
> > > > Complete requests:      10000
> > > > Failed requests:        0
> > > > Write errors:           0
> > > > Total transferred:      326745046 bytes
> > > > HTML transferred:       322174102 bytes
> > > > Requests per second:    2674.48 [#/sec] (mean)
> > > > Time per request:       18.695 [ms] (mean)
> > > > Time per request:       0.374 [ms] (mean, across all concurrent
> requests)
> > > > Transfer rate:           85339.04 [Kbytes/sec] received
> > > > ------------------------------
> > > > So my question is: why squid is slower than apache? Thanks.
> > > >
> > >
> > > --
> > > Marcos Camões Bourgeaiseau - KIKO
> > > e-mail normal: [hidden email]
> > > e-mail para anexos grandes: [hidden email]
> > >
> >
>
> Why Squid request status is not TCP_MEM_HIT:NONE!  TCP_HIT:NONE. means hit
> on the disk, the same as apache!
> So ,use the squid will slower than  your apache
>
> --
> This is gogo407
> Have Fun


--
程卫星 13331170582
Reply | Threaded
Open this post in threaded view
|

Re: My squid is slower than apache

Adrian Chadd
In reply to this post by 程卫星
On Fri, Jul 20, 2007, cwx wrote:
> TCP_HIT means a valid copy of the requested object was in the cache.
> Apache received less than 30 request.

It should be a TCP_MEM_HIT, shouldn't it?

Part of what makes Squid "good" in front of apache is being able
to cache the static stuff without tying up apache resources better
spent on dynamic content. If you're benchmarking apache vs squid
for static content then you're going to lose out.



Adrian

Reply | Threaded
Open this post in threaded view
|

How to get the exact URL for the video page accessed at youtube

sa-13
In reply to this post by 程卫星

Hi,

How to get the exact URL for the video page accessed at youtube?

The logs i get at /var/log/squid/access.log are somethig like:

1184909884.595 731343 IP_address TCP_MISS/200 11193996 GET
http://sjl-v138.sjl.youtube.com/get_video? - DIRECT/64.15.120.41 video/flv
1184910364.897 267150 IP_address TCP_MISS/200 5105232 GET
http://lax-v148.lax.youtube.com/get_video? - DIRECT/64.15.112.112 video/flv
1184911008.639 345580 IP_address TCP_MISS/200 7128791 GET
http://chi-v274.chi.youtube.com/get_video? - DIRECT/64.15.126.23 video/flv
1184912643.971 469498 IP_address TCP_MISS/200 6253234 GET
http://lax-v46.lax.youtube.com/get_video? - DIRECT/208.65.155.149 video/flv


But this does not show the actual video webpage accessed (something like
http://youtube.com/watch?v=HtVbAazUekM)


Regards,

SA


Reply | Threaded
Open this post in threaded view
|

Re: My squid is slower than apache

Henrik Nordström
In reply to this post by Adrian Chadd
On fre, 2007-07-20 at 11:39 +0800, Adrian Chadd wrote:
> On Fri, Jul 20, 2007, cwx wrote:
> > TCP_HIT means a valid copy of the requested object was in the cache.
> > Apache received less than 30 request.
>
> It should be a TCP_MEM_HIT, shouldn't it?

If it was in memory yes, which it will only be if it's below the
threshold set in squid.conf and was fetched by Squid during this run..

Regards
Henrik

signature.asc (316 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: My squid is slower than apache

Henrik Nordström
In reply to this post by 程卫星
On fre, 2007-07-20 at 11:15 +0800, cwx wrote:
> TCP_HIT means a valid copy of the requested object was in the cache.
> Apache received less than 30 request.

Try this:

grab Squid-2.HEAD from http://www.squid-cache.org/Versions/v2/HEAD/

install a somewhat recent Linux version

Configure Squid with a reasonably cache_mem, a null cache_dir and
reasonably sized maximum_object_size_in_memory settings for your
content.

Example:

cache_mem 128 MB
cache_dir null /null
maximum_object_size_in_memory 1 MB


Regards
Henrik

signature.asc (316 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: My squid is slower than apache

程卫星
After using these settings, squid is faster than before, but still
slower than Apache.

Apache only:
---------------------------
Document Path:          /images20/header.jpg
Document Length:        32157 bytes
Concurrency Level:      50
Time taken for tests:   28.86365 seconds
Complete requests:      100000
Failed requests:        0
Write errors:           0
Total transferred:      -1043138666 bytes
HTML transferred:       -1078947616 bytes
Requests per second:    3560.45 [#/sec] (mean)
Time per request:       14.043 [ms] (mean)
Time per request:       0.281 [ms] (mean, across all concurrent requests)
Transfer rate:          -36269.91 [Kbytes/sec] received
Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    2  42.4      2    3001
Processing:     2   10   2.0     11      71
Waiting:          0    2   1.0      2      65
Total:              3   13  42.4     13    3013
Percentage of the requests served within a certain time (ms)
  50%     13
  66%     14
  75%     14
  80%     14
  90%     14
  95%     14
  98%     14
  99%     15
 100%   3013 (longest request)

Squid with Apache:
----------------------------------
Document Path:          /images20/header.jpg
Document Length:        32157 bytes

Concurrency Level:      50
Time taken for tests:   33.178911 seconds
Complete requests:      100000
Failed requests:        0
Write errors:           0
Total transferred:      -1033332671 bytes
HTML transferred:       -1079149123 bytes
Requests per second:    3013.96 [#/sec] (mean)
Time per request:       16.589 [ms] (mean)
Time per request:       0.332 [ms] (mean, across all concurrent requests)
Transfer rate:          -30414.29 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:         0    1  26.9      1    3003
Processing:     1   14  65.2     14    5024
Waiting:          0    3  65.0      3    5011
Total:              3   16  70.4     15    5025

Percentage of the requests served within a certain time (ms)
  50%     15
  66%     16
  75%     17
  80%     17
  90%     17
  95%     18
  98%     19
  99%     19
 100%   5025 (longest request)
2007/7/21, Henrik Nordstrom <[hidden email]>:

> On fre, 2007-07-20 at 11:15 +0800, cwx wrote:
> > TCP_HIT means a valid copy of the requested object was in the cache.
> > Apache received less than 30 request.
>
> Try this:
>
> grab Squid-2.HEAD from http://www.squid-cache.org/Versions/v2/HEAD/
>
> install a somewhat recent Linux version
>
> Configure Squid with a reasonably cache_mem, a null cache_dir and
> reasonably sized maximum_object_size_in_memory settings for your
> content.
>
> Example:
>
> cache_mem 128 MB
> cache_dir null /null
> maximum_object_size_in_memory 1 MB
>
>
> Regards
> Henrik
>
>


--
程卫星 13331170582
K K
Reply | Threaded
Open this post in threaded view
|

Re: My squid is slower than apache

K K
In reply to this post by Adrian Chadd
These numbers appear to indicate that Squid is nearly as fast as
Apache serving up static content, which is pretty much exactly what I
would expect.

The very high 'max' field suggests that the total is being skewed by
one very slow transaction, both for Apache (3 seconds) and then even
more so for Squid (5 seconds)?

>Apache only:
>. . .
>Connection Times (ms)
>             min  mean[+/-sd] median   max
>Connect:        0    2  42.4      2    3001
>Processing:     2   10   2.0     11      71
>Waiting:          0    2   1.0      2      65
>Total:              3   13  42.4     13    3013
. . .
>Squid with Apache:
. . .
>Connection Times (ms)
>             min  mean[+/-sd] median   max
>Connect:         0    1  26.9      1    3003
>Processing:     1   14  65.2     14    5024
>Waiting:          0    3  65.0      3    5011
>Total:              3   16  70.4     15    5025


Words of wisdom:
On 7/19/07, Adrian Chadd <[hidden email]> wrote:
>  If you're benchmarking apache vs squid
> for static content then you're going to lose out.

Kevin
Reply | Threaded
Open this post in threaded view
|

Re: How to get the exact URL for the video page accessed at youtube

Chris Robertson-2
In reply to this post by sa-13
[hidden email] wrote:

> Hi,
>
> How to get the exact URL for the video page accessed at youtube?
>
> The logs i get at /var/log/squid/access.log are somethig like:
>
> 1184909884.595 731343 IP_address TCP_MISS/200 11193996 GET
> http://sjl-v138.sjl.youtube.com/get_video? - DIRECT/64.15.120.41 video/flv
> 1184910364.897 267150 IP_address TCP_MISS/200 5105232 GET
> http://lax-v148.lax.youtube.com/get_video? - DIRECT/64.15.112.112 video/flv
> 1184911008.639 345580 IP_address TCP_MISS/200 7128791 GET
> http://chi-v274.chi.youtube.com/get_video? - DIRECT/64.15.126.23 video/flv
> 1184912643.971 469498 IP_address TCP_MISS/200 6253234 GET
> http://lax-v46.lax.youtube.com/get_video? - DIRECT/208.65.155.149 video/flv
>
>
> But this does not show the actual video webpage accessed (something like
> http://youtube.com/watch?v=HtVbAazUekM)
>
>
> Regards,
>
> SA
>
>
>  
 From squid.conf:

#  TAG: strip_query_terms
#       By default, Squid strips query terms from requested URLs before
#       logging.  This protects your user's privacy.
#
#Default:
# strip_query_terms on

As an aside, if you are starting a new thread, please don't respond to a
message.

Chris
Reply | Threaded
Open this post in threaded view
|

Re: My squid is slower than apache

Chris Robertson-2
In reply to this post by 程卫星
cwx wrote:
> My squid setting:
> cache_mem 1536 MB
> maximum_object_size_in_memory 1024 KB
>
> Is this misconfigured?

No way to tell without more context.  See
http://wiki.squid-cache.org/SquidFaq/SquidMemory for more details.

Chris