ZxMobile + NginX = ...
 
Notifications
Clear all

ZxMobile + NginX = High battery consuming

1 Posts
1 Users
0 Likes
512 Views
 niko
(@niko)
Posts: 13
Topic starter
 

Hello,

OS : Ubuntu Server 12.04.4 LTS 64bits
Kernel : 3.2.0-60-generic
Zimbra : Release 8.0.6.GA.5922.UBUNTU12.64 UBUNTU12_64 FOSS edition
ZeXtras : 1.8.13
Apache : 2.2.22 Prefork

We used to have an Apache reverse proxy behind our Zimbra server and for several reasons, we had to remove it and use the Zimbra embedded NginX as reverse proxy (which should be good since it's provided by Zimbra itself).

With Apache, we had no issue with mobile phones + ActiveSync (in push mode) but as soon as we switched to NginX, all our mobile devices configured in push mode began to consume a lot of battery (about twice more than before)

With Apache (and same with NginX), our network architecture is as below :

Internet ----- a.b.c.d:443 -----> RP (with SSL) ----- 127.0.0.1:7080 -----> Zimbra (Jetty)

Apache configuration used to be :

ServerLimit         512
StartServers         16
MinSpareServers      16
MaxSpareServers      32
MaxClients          256
MaxRequestsPerChild  16

Listen a.b.c.d:443
Timeout 1800
UseCanonicalName Off
ServerSignature Off

KeepAlive On
KeepAliveTimeout 15
MaxKeepAliveRequests 128

ProxyTimeout 1800
ProxyPreserveHost On

SSLEngine on
SSLCACertificateFile  ca.crt
SSLCertificateFile    server.crt
SSLCertificateKeyFile server.key

RewriteEngine On
RewriteRule ^/(.*)  http://localhost:7080/$1  

Now, NginX configuration is (which is mostly the default configuration provided by Zimbra) :

http
{
  server_tokens off;
  server_names_hash_max_size    512;
  server_names_hash_bucket_size 64;

  proxy_read_timeout 60s;
  proxy_send_timeout 60s;

  chunkin on;
  tcp_keepalive on;

  upstream zimbra
  {
    server    localhost:7080 fail_timeout=60s;
    zmauth;
  }

  server
  {
    listen                    a.b.c.d:443;
    client_max_body_size      0;
    ssl                       on;
    ssl_prefer_server_ciphers on;
    ssl_ciphers               !SSLv2:!MD5:HIGH;
    ssl_certificate           server.chain.crt;
    ssl_certificate_key       server.key;

    location ^~ /Microsoft-Server-ActiveSync
    {
      set $mailhostport 7080;
      set $relhost $host;

      if ($mailhostport != 80)
      {
        set $relhost $host:$mailhostport;
      }

      proxy_pass           http://zimbra; 
      proxy_read_timeout  3600;
      proxy_buffering     off;
      proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;

      set $virtual_host $http_host;
      if ($virtual_host = '')
      {
        set $virtual_host $server_addr:$server_port;
      }

      proxy_set_header Host            $virtual_host;
      proxy_redirect  http://$http_host/  https://$http_host/;
      proxy_redirect  http://$relhost/  https://$http_host/;
    }
  }
}

I can't figure out why with NginX, mobile batteries are dumped that much.

I analysed network frames and I could notice a difference between Apache and NginX : NginX works in HTTP/1.0 where Apache uses HTTP/1.1 due to the "KeepAlive on" statement. I tried to turn on KeepAlive on NginX :

[...]

  upstream zimbra
  {
    server    localhost:7080 fail_timeout=60s;
    keepalive 2048;
    zmauth;
  }

[...]

    location ^~ /Microsoft-Server-ActiveSync
    {
      proxy_http_version 1.1;
      proxy_set_header Connection "";
      keepalive_timeout 15;
[...]

But it changes nothing. I tried to turn off and on mobiles, I tried to delete and setup again accounts on mobiles, nothing works, batteries are dumped.

Any help would be greatly appreciated 🙂

Thanks
Regards

OS : Ubuntu Server 12.04.4 LTS 64bits
Kernel : 3.2.0-60-generic
Zimbra : Release 8.0.6.GA.5922.UBUNTU12.64 UBUNTU12_64 FOSS edition
ZeXtras : 1.8.13
Apache : 2.2.22 Prefork

We used to have an Apache reverse proxy behind our Zimbra server and for several reasons, we had to remove it and use the Zimbra embedded NginX as reverse proxy (which should be good since it's provided by Zimbra itself).

With Apache, we had no issue with mobile phones + ActiveSync (in push mode) but as soon as we switched to NginX, all our mobile devices configured in push mode began to consume a lot of battery (about twice more than before)

With Apache (and same with NginX), our network architecture is as below :

Internet ----- a.b.c.d:443 -----> RP (with SSL) ----- 127.0.0.1:7080 -----> Zimbra (Jetty)

Apache configuration used to be :

ServerLimit         512
StartServers         16
MinSpareServers      16
MaxSpareServers      32
MaxClients          256
MaxRequestsPerChild  16

Listen a.b.c.d:443
Timeout 1800
UseCanonicalName Off
ServerSignature Off

KeepAlive On
KeepAliveTimeout 15
MaxKeepAliveRequests 128

ProxyTimeout 1800
ProxyPreserveHost On

SSLEngine on
SSLCACertificateFile  ca.crt
SSLCertificateFile    server.crt
SSLCertificateKeyFile server.key

RewriteEngine On
RewriteRule ^/(.*)  http://localhost:7080/$1  

Now, NginX configuration is (which is mostly the default configuration provided by Zimbra) :

http
{
  server_tokens off;
  server_names_hash_max_size    512;
  server_names_hash_bucket_size 64;

  proxy_read_timeout 60s;
  proxy_send_timeout 60s;

  chunkin on;
  tcp_keepalive on;

  upstream zimbra
  {
    server    localhost:7080 fail_timeout=60s;
    zmauth;
  }

  server
  {
    listen                    a.b.c.d:443;
    client_max_body_size      0;
    ssl                       on;
    ssl_prefer_server_ciphers on;
    ssl_ciphers               !SSLv2:!MD5:HIGH;
    ssl_certificate           server.chain.crt;
    ssl_certificate_key       server.key;

    location ^~ /Microsoft-Server-ActiveSync
    {
      set $mailhostport 7080;
      set $relhost $host;

      if ($mailhostport != 80)
      {
        set $relhost $host:$mailhostport;
      }

      proxy_pass           http://zimbra; 
      proxy_read_timeout  3600;
      proxy_buffering     off;
      proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;

      set $virtual_host $http_host;
      if ($virtual_host = '')
      {
        set $virtual_host $server_addr:$server_port;
      }

      proxy_set_header Host            $virtual_host;
      proxy_redirect  http://$http_host/  https://$http_host/;
      proxy_redirect  http://$relhost/  https://$http_host/;
    }
  }
}

I can't figure out why with NginX, mobile batteries are dumped that much.

I analysed network frames and I could notice a difference between Apache and NginX : NginX works in HTTP/1.0 where Apache uses HTTP/1.1 due to the "KeepAlive on" statement. I tried to turn on KeepAlive on NginX :

[...]

  upstream zimbra
  {
    server    localhost:7080 fail_timeout=60s;
    keepalive 2048;
    zmauth;
  }

[...]

    location ^~ /Microsoft-Server-ActiveSync
    {
      proxy_http_version 1.1;
      proxy_set_header Connection "";
      keepalive_timeout 15;
[...]

But it changes nothing. I tried to turn off and on mobiles, I tried to delete and setup again accounts on mobiles, nothing works, batteries are dumped.

Any help would be greatly appreciated 🙂

Thanks
Regards

Internet

a.b.c.d:443
> RP (with SSL)
127.0.0.1:7080
> Zimbra (Jetty)

Apache configuration used to be :

ServerLimit 512
StartServers 16
MinSpareServers 16
MaxSpareServers 32
MaxClients 256
MaxRequestsPerChild 16

Listen a.b.c.d:443
Timeout 1800
UseCanonicalName Off
ServerSignature Off

KeepAlive On
KeepAliveTimeout 15
MaxKeepAliveRequests 128

ProxyTimeout 1800
ProxyPreserveHost On

SSLEngine on
SSLCACertificateFile ca.crt
SSLCertificateFile server.crt
SSLCertificateKeyFile server.key

RewriteEngine On
RewriteRule ^/(.*) http://localhost:7080/$1

Now, NginX configuration is (which is mostly the default configuration provided by Zimbra) :

http
{
  server_tokens off;
  server_names_hash_max_size    512;
  server_names_hash_bucket_size 64;

  proxy_read_timeout 60s;
  proxy_send_timeout 60s;

  chunkin on;
  tcp_keepalive on;

  upstream zimbra
  {
    server    localhost:7080 fail_timeout=60s;
    zmauth;
  }

  server
  {
    listen                    a.b.c.d:443;
    client_max_body_size      0;
    ssl                       on;
    ssl_prefer_server_ciphers on;
    ssl_ciphers               !SSLv2:!MD5:HIGH;
    ssl_certificate           server.chain.crt;
    ssl_certificate_key       server.key;

    location ^~ /Microsoft-Server-ActiveSync
    {
      set $mailhostport 7080;
      set $relhost $host;

      if ($mailhostport != 80)
      {
        set $relhost $host:$mailhostport;
      }

      proxy_pass           http://zimbra; 
      proxy_read_timeout  3600;
      proxy_buffering     off;
      proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;

      set $virtual_host $http_host;
      if ($virtual_host = '')
      {
        set $virtual_host $server_addr:$server_port;
      }

      proxy_set_header Host            $virtual_host;
      proxy_redirect  http://$http_host/  https://$http_host/;
      proxy_redirect  http://$relhost/  https://$http_host/;
    }
  }
}

I can't figure out why with NginX, mobile batteries are dumped that much.

I analysed network frames and I could notice a difference between Apache and NginX : NginX works in HTTP/1.0 where Apache uses HTTP/1.1 due to the "KeepAlive on" statement. I tried to turn on KeepAlive on NginX :

[...]

  upstream zimbra
  {
    server    localhost:7080 fail_timeout=60s;
    keepalive 2048;
    zmauth;
  }

[...]

    location ^~ /Microsoft-Server-ActiveSync
    {
      proxy_http_version 1.1;
      proxy_set_header Connection "";
      keepalive_timeout 15;
[...]

But it changes nothing. I tried to turn off and on mobiles, I tried to delete and setup again accounts on mobiles, nothing works, batteries are dumped.

Any help would be greatly appreciated 🙂

Thanks
Regards

ServerLimit         512
StartServers 16
MinSpareServers 16
MaxSpareServers 32
MaxClients 256
MaxRequestsPerChild 16

Listen a.b.c.d:443
Timeout 1800
UseCanonicalName Off
ServerSignature Off

KeepAlive On
KeepAliveTimeout 15
MaxKeepAliveRequests 128

ProxyTimeout 1800
ProxyPreserveHost On

SSLEngine on
SSLCACertificateFile ca.crt
SSLCertificateFile server.crt
SSLCertificateKeyFile server.key

RewriteEngine On
RewriteRule ^/(.*) http://localhost:7080/$1

Now, NginX configuration is (which is mostly the default configuration provided by Zimbra) :

http
{
server_tokens off;
server_names_hash_max_size 512;
server_names_hash_bucket_size 64;

proxy_read_timeout 60s;
proxy_send_timeout 60s;

chunkin on;
tcp_keepalive on;

upstream zimbra
{
server localhost:7080 fail_timeout=60s;
zmauth;
}

server
{
listen a.b.c.d:443;
client_max_body_size 0;
ssl on;
ssl_prefer_server_ciphers on;
ssl_ciphers !SSLv2:!MD5:HIGH;
ssl_certificate server.chain.crt;
ssl_certificate_key server.key;

location ^~ /Microsoft-Server-ActiveSync
{
set $mailhostport 7080;
set $relhost $host;

if ($mailhostport != 80)
{
set $relhost $host:$mailhostport;
}

proxy_pass http://zimbra;
proxy_read_timeout 3600;
proxy_buffering off;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

set $virtual_host $http_host;
if ($virtual_host = '')
{
set $virtual_host $server_addr:$server_port;
}

proxy_set_header Host $virtual_host;
proxy_redirect http://$http_host/ https://$http_host/;
proxy_redirect http://$relhost/ https://$http_host/;
}
}
}

I can't figure out why with NginX, mobile batteries are dumped that much.

I analysed network frames and I could notice a difference between Apache and NginX : NginX works in HTTP/1.0 where Apache uses HTTP/1.1 due to the "KeepAlive on" statement. I tried to turn on KeepAlive on NginX :

[...]

  upstream zimbra
  {
    server    localhost:7080 fail_timeout=60s;
    keepalive 2048;
    zmauth;
  }

[...]

    location ^~ /Microsoft-Server-ActiveSync
    {
      proxy_http_version 1.1;
      proxy_set_header Connection "";
      keepalive_timeout 15;
[...]

But it changes nothing. I tried to turn off and on mobiles, I tried to delete and setup again accounts on mobiles, nothing works, batteries are dumped.

Any help would be greatly appreciated 🙂

Thanks
Regards

http
{
server_tokens off;
server_names_hash_max_size 512;
server_names_hash_bucket_size 64;

proxy_read_timeout 60s;
proxy_send_timeout 60s;

chunkin on;
tcp_keepalive on;

upstream zimbra
{
server localhost:7080 fail_timeout=60s;
zmauth;
}

server
{
listen a.b.c.d:443;
client_max_body_size 0;
ssl on;
ssl_prefer_server_ciphers on;
ssl_ciphers !SSLv2:!MD5:HIGH;
ssl_certificate server.chain.crt;
ssl_certificate_key server.key;

location ^~ /Microsoft-Server-ActiveSync
{
set $mailhostport 7080;
set $relhost $host;

if ($mailhostport != 80)
{
set $relhost $host:$mailhostport;
}

proxy_pass http://zimbra;
proxy_read_timeout 3600;
proxy_buffering off;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

set $virtual_host $http_host;
if ($virtual_host = '')
{
set $virtual_host $server_addr:$server_port;
}

proxy_set_header Host $virtual_host;
proxy_redirect http://$http_host/ https://$http_host/;
proxy_redirect http://$relhost/ https://$http_host/;
}
}
}

I can't figure out why with NginX, mobile batteries are dumped that much.

I analysed network frames and I could notice a difference between Apache and NginX : NginX works in HTTP/1.0 where Apache uses HTTP/1.1 due to the "KeepAlive on" statement. I tried to turn on KeepAlive on NginX :

[...]

upstream zimbra
{
server localhost:7080 fail_timeout=60s;
keepalive 2048;
zmauth;
}

[...]

location ^~ /Microsoft-Server-ActiveSync
{
proxy_http_version 1.1;
proxy_set_header Connection "";
keepalive_timeout 15;
[...]

But it changes nothing. I tried to turn off and on mobiles, I tried to delete and setup again accounts on mobiles, nothing works, batteries are dumped.

Any help would be greatly appreciated 🙂

Thanks
Regards

[...]

upstream zimbra
{
server localhost:7080 fail_timeout=60s;
keepalive 2048;
zmauth;
}

[...]

location ^~ /Microsoft-Server-ActiveSync
{
proxy_http_version 1.1;
proxy_set_header Connection "";
keepalive_timeout 15;
[...]

But it changes nothing. I tried to turn off and on mobiles, I tried to delete and setup again accounts on mobiles, nothing works, batteries are dumped.

Any help would be greatly appreciated :)

Thanks
Regards

 
Posted : 03/28/2014 15:03