IMAP IDLE: The best approach for ‘push’ email

Thu 19 July 18 Comments are Closed

Summary
The concept of “push email” has been widely marketed as a desirable feature of mobile email services, to enable users to get immediate notification of and access to new messages. This article looks at various approaches to meeting user requirements, and concludes that the Internet Standard IMAP (Internet Message Access Protocol) IDLE command is the best way to achieve this service.

What are the User Requirements?


“Push Email” is an unfortunate choice of terminology, as it implies a specific technical solution to a more generic user requirement. The primary user requirement described by “push email” is:

“Whenever a new message is delivered to my mailbox, I want to be notified ‘immediately’ that the message has arrived.”

‘Immediately’ in the context of store and forward messaging would typically be interpreted as “a few seconds”, rather than hours and minutes. There are some associated secondary requirements that should be addressed

1) The user should have control over message download to the mobile device. A typical choice would be to automatically download small messages, and to download larger messages under user control.

2) The user should be able to turn off notifications when desired.

3) The user should have control over which messages lead to notifications (e.g., only messages from the boss!).

Polling is a Poor Solution


The basic approach used by many email devices is to connect to the server to access new messages. This is a good model for many uses of mobile email, where access to email is under user control – the user checks email when the user wants to.

In order achieve automatic notification of new messages, a simple approach is to use ‘polling’ where the mobile client automatically connects to the server at intervals to check for new messages. However, there are two main problems with this approach:

1) Frequent polling is an inefficient use of network and mobile device resources, increasing the cost to the user.

2) New mail notification is only as frequent at the polling, and not ‘immediate’.

Polling is a poor solution for a user needing immediate notification.

What is IMAP IDLE?


IMAP (Internet Message Access Protocol) is the best open standard for accessing mobile email. It handles immediate notification as part of general operations and by the IDLE command, which is a widely implemented standard extension to the core IMAP protocol.

How IDLE Works

IMAP works by the software on the mobile device (the client) issuing commands to the server. An IMAP server provides two things in response to a client command:

1) An answer to the request.

2) Information on any new messages.

This means that where a client is actively doing things with an IMAP server, it will be told immediately about new messages. The client can then get summary information on the message to present to the user, and can (automatically) download the message when appropriate.

This means that an active client will always be kept up to date. The IDLE command deals with the situation where the client has no more requests to make. The server responds to the idle command when there is a new message (or messages) which indicates to the client that there are new messages.

When the user is inactive, and does not wish to receive notifications, the client simply stops using IDLE, which is very efficient.

Performance

The basic network use of the IDLE command is very small, and so it makes very efficient use of bandwidth. In practice things are made more complex by the problem of timeouts occuring when there is no activity keeping the connection open. The main timeouts that will occur are:

1) IMAP server timeout: Typically occurs after 30 minutes with no activity.

2) NAT Gateway timeout: Most mobile devices access the Internet through a device operated by the mobile service provider called a NAT (Network Address Translation) gateway. These will typically time out an idle connection after 15 minutes.

The solution to this is for the IMAP client to issue a NOOP (No Operation) command at intervals, typically every 15 minutes. This will exchange a few bytes of data, and keep everything active. The impact of holding an IMAP connection open on the client, server and intermediate components should be considered:

1) IMAP Server. A good IMAP server will have minimal overhead for an Idle connection, and should be able to support 10’s or 100’s of thousands of connections.

2) IP Routers and other network components. Negligible impact.

3) Phone. For older phones there could be an issue of increased battery usage due to holding the connection open. This is unlikely to be a problem on a modern phone.

Another practical problem is that current phone networking technology will lose IP network connectivity from time to time, and this will need to be automatically re-established, and the IMAP connection re-established if this is lost due to a long network failure.

In summary, the overall IMAP IDLE architecture has good performance.

‘True’ Push


An alternative to the IMAP IDLE approach is for a mechanism whereby the server pushes something to the client when a new message arrives, without there being an open connection from the client to the server. This section looks at this approach.

Alert vs Message Send

There are two variants of the ‘true’ push approach:

1) Push the new message.

2) Push a short generic message alert, prompting the client to connect to the server in order to retrieve the message.

Using approach 1 leads to three problems:

1) The mechanism will need to deal with security and data confidentiality, which leads to a lot of additional complexity.

2) The data being pushed becomes larger, which reduces the options for sending the data (e.g., SMS could not be used).

3) There is no client control on the choice to download.

For these reasons, the second approach is generally better, and this is the one considered here.

Implementation Options

A clean way to send data from the server to the mobile device would be for the server to open a TCP connection. This would give a lot of flexibility in protocol choice and deployment. Unfortunately, this is impractical because most mobile devices do not have registered IP addresses to which a server can connect. They are also generally connected through a NAT gateway that will prevent connections being made to the phone. This means that use of a TCP connection is not generally a viable option.

This means that another mechanism needs to be used to do the ‘push’. There are various options to do this. SMS is a good candidate, as it is widely supported as a data listening mechanism on most mobile devices. SMS is used as an example interconnect mechanism in this paper. The use of SMS as the mechanism to carry messaging alerts leads to two integration problems:

1) Phone. SMS is a general purpose service, not specific to email. There are two integration approaches:

1a) Use a “you’ve got mail” message to the human user, who will then connect with the email application. This crude approach would only be suitable for very basic use.

1b) Standardize how SMS is used, so that phones can detect email notifications and pass them to the email client for automatic processing.

2) Messaging server. There are two deployment scenarios:

2a) Messaging server deployed by a mobile operator. In this scenario integration with SMS is straightforward.

2b) Messaging server deployed by the end organization or independent service provider. Typically such a deployment will rely on Internet access. Integration with SMS would provide both technical problems (how to make it happen) and commercial problems (who pays for the SMS message, and how to prevent abuse).

These problems are not insurmountable, but will be a barrier to widespread adoption.

Performance

The response time and data use of this push approach are contrasted to IMAP IDLE. A messaging server offering both approaches would be able to send the push notification and IDLE response at the same time. The IDLE response is immediate, and it will initiate the client to deal with the new messages. The push notification will have two delays:

1) Time for the SMS message to reach the phone. This may be a few seconds, but could take longer.

2) Time for the client to connect to the server. This will typically be a few seconds.
True push will be somewhat slower than IMAP IDLE, but in practice this is not likely to be a big problem.

Data usage for IMAP IDLE is essentially the 15 minute NOOP to keep the connection alive, plus a small amount of data to do the notification. The true push will have the cost of the SMS notification. The data for connection establishment is more significant, typically including TCP Connection; TLS (for data confidentiality); client authentication; client (re) synchronization.

It can be seen that for frequent message arrival, that IMAP IDLE is more efficient and that for longer intervals between notifications that true push has better data efficiency. The details will depend on many parameters. A rough calculation suggests that a typical break-even point would be around two days. This suggests that for a typical user receiving and getting notifications for 10 messages per day, that IMAP IDLE has significantly better data performance.

When the user does not want to receive notifications, there is a need to change server configuration (which causes extra complexity and network activity).

Conclusions


IMAP + IMAP IDLE is a good approach for providing the immediate email notification and delivery service of “push email”. It has substantial implementation, deployment and performance advantages over a “true push” approach. Imageway offers a solid, fast, and fully compliant IMAP email service implementation with IMAP IDLE support for push email.

WebMail Quick Help

Sun 25 March 18 Comments are Closed

Imageway WebMail User Help

Imageway WebMail end user help.

Labels

Imageway WebMail has two slightly different forms of labels with comparitive advantages as below:

Universal labels

Should be used for labels you use frequently and may want to change on multiple messages. This uses IMAP user flags to store the labels.

  • This is efficient
  • Labels can be viewed with another IMAP mail client
  • There is a limit of 22 of these labels – which includes any your IMAP mail clients may create

Imageway WebMail labels

Only use if you need more than 22 labels or imap user flags cannot be enabled. Avoid using these on large messages. This stores the label as an additional header in your IMAP message. This requires Imageway WebMail to modify and re-upload your email message to the server.

  • There is no limit on the number of labels that can be created
  • This is less efficient (particularly on large emails), and can only be set on a limited number of messages at a time
  • Labels can only be viewed from Imageway WebMail
  • If you do a “forward attach” the labels will be sent as part of the message headers so the recipient may be able to view them (just like labelling using Thunderbird in POP mode)

Labels can be added and removed from messages as much as you like. However for both types of labels once the label has been created it cannot be deleted (for implementation reasons).
You can however rename the display name or hide labels from display.

Searching

Imageway WebMail has three different ways of searching for messages

Quick search

This is a ‘search as you type’ browser side ‘full text match only’ search of the displayed headers of the current page of messages. This is useful for quickly locating certain messages without waiting for the delay involved in going to the server for more advanced searches.
Note: This will not search message bodies or other pages of messages in the currently displayed folder (see hint below)

Quick Search

HINT: When Enter is pressed a “quick search” will be automatically switched to a “folder search” under certain conditions. In particular: if there are multiple pages of messages in a folder, if advanced search syntax characters are found (colon or minus or double quote), or control-enter is pressed.

Folder search

This is a very fast server side headers search of all the messages in one or more folders. This search capability allows for the search for multiple search terms that are ‘ANDed’ together and allows for searching specific fields:
Note: This will not search message bodies, and only searches messages in folders that have already been accessed and indexed by Imageway WebMail (manually refresh by right clicking a folder and select refresh or refresh all)

Folder Search

note: The “Recent” option only searches folders that have been accessed in the last month. The “All” option will search all folders but does not refresh the mesage indexes from IMAP so may not find the message you are looking for. Click any folders in question to refresh the indexes.

Body search

IMAP serverside search of the full message body and headers content. This can take a long time on large folders / or large accounts – expect approx 30 seconds per 100 MB of mail that needs to be searched through.
One or more search terms can be specified which will be ANDed together.

Note: This may take a long time

Body search syntax:
joe All messages with the word ‘joe’ anywhere in the message
joe blogs All messages with the word ‘joe’ AND ‘blogs’ anywhere in the message
“joe blogs” All messages with the string ‘joe blogs’ anywhere in the message

Spam handling

Imageway WebMail uses the surgemail user.cgi Friends and spam handling features. Manually correcting false positives and training messages as spam can be done using the following actions in Imageway WebMail or in an IMAP client:

SPAM Handling

Primary action

actioned in INBOX or other folder

actioned in Spam folder
Rate This Entry:
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

How to increase the WebDAV file limit in Windows

Thu 06 April 17 Comments are Closed

In Windows XP and later, the Windows file redirector has a built-in WebDAV client which can be used to mount a Windows drive letter to our on-line Mobile Office service. When you copy files to this drive mapping, they are stored on our Mobile Office server, which can be accessed from any computer via a drive mapping or via the Mobile Office web interface. When trying to copy large files you might run into a error that says “Error 0x800700DF: The file size exceeds the limit allowed and cannot be saved”. Windows has a built in limit on the size of a file that is allowed to be copied using WebDAV. To change this limit you must edit the a registry subkey which holds the value limit, and reboot your computer. To change this registry setting do the following:

1) Click Start, click Run, type regedit in the Open box, and then click “Ok”.
2) Locate “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WebClient\Parameters” from the drop-down structure in left pane.
3) Right click on the “FileSizeLimitInBytes” subkey listed in the right pane, then click “Modify”.
4) Click the “Decimal” bubble under the “Base” section.
4) In the “Value data” box, type 4294967295, and then click “Ok”.
6) Reboot your computer.

Completing the above sets the maximum you can copy via WebDAV to 4 gig for a single file.

Rate This Entry:
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

Email Archiving

Wed 24 July 13 Comments are Closed

An email archive is a repository generally kept in a non-productive environment to provide secure preservation of email for compliance and operational purposes. A email archiving system automatically extracts message contents and attachments from incoming/outgoing emails and after indexing, it stores them in read-only format. This ensures that archived records are maintained in their original state.

The active approach adopted by email archiving solutions ensures that the company has a centralized and accessible copy of all its email. This provides additional protection against accidental or intentional deletion of emails by end-users. Email archiving also eliminates the need to search for personal archives on each and every local machine whenever litigation support is requested.

It must be noted that ‘backup’ and ‘archival’ storage serve two different purposes. Backups are intended to save current data against the event of failure or disaster whilst archives protect data so that it can be accessed when needed.

Email archiving is available on all our Email Hosting accounts. The email archiving feature is disabled by default. To turn it on do the following:

1) Login to the “Domain Management” section on the Email Message System for your domain.
2) Click the “Misc” button.
3) Make sure the “Disable Legal Archive” option is unchecked, and then click the “Save” button.

Once you do this, a copy of all incoming and outgoing email for your domain will be kept in a read only archive for 7 years. To access this archive click the “Legal Archive” button within the “Domain Management” interface.

If you require a custom email archive setup, please contact us.  We can set up a email archive that will keep archives for shorter or longer periods or will only archive specific email based on “To”, “From”, or “Subject”.

Email archiving requirements are different based on country, state, and type of business. Be sure to research to find what email archiving is required for your business. One such document to aid in your research is available at: http://www.techlineinc.com/librarypdf/alchemy/3497al_ostermanwhitepaper_0405.pdf

Rate This Entry:
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

How to send and receive secure encrypted emails

Mon 01 July 13 Comments are Closed

  Imageway supports multiple technologies to allow secure encrypted sending and receiving of email. To talk to our mail system to send and retrieve email you usually have two options. Option one is using our webmail. Option two is using a 3rd party email client such as Outlook, Mac Mail, or Thunderbird. If you use our webmail, your connection to our mail system is encrypted using a secure web browser connection (HTTPS) automatically. If you use a 3rd party email client, you must tell your client to use IMAP(S), POP(S), and SMTP(S), where “S” is secure. You can find instructions on your domain’s email message center web page on setting up various email clients for a secure connection.

Now that you have your computer or mobile device talking to our system using a secure encrypted connection, you can send emails to anyone on your local domain and it will be secure. For example if “bob@mydomain.com” sends email to “jill@mydomain.com”, the email will reside on the same system, so it will be secure. But what happens if you want to send to another domain, such as “gmail.com”.  This is where things get more complex. When you send email to someone on another domain that is not located on our email system, our system has to talk to another email system using SMTP. In most circumstances this connection is unsecure and is not encrypted.  Our email system will try to make a secure encrypted connection to the other email system if the other system supports it.  If it does not, then an unsecured connection will be used. Most of the big email providers do not support secure SMTP currently, with the current exception being Gmail. Gmail does support secure SMTP.

To ensure outgoing email to another domain is sent securely you have two options:

1)      Imageway Mail Vault – Our built in encryption system allows you to send encrypted emails by storing the outgoing email on our server, and then our email system will automatically send an email to the person receiving the email, notifying them to click a web page link to read the email.  Once they click the link they are taken to a secure (HTTPS) website where they can read and reply to the email after they have been verified. You can send secure email using the Imageway Mail Vault by clicking the “pad lock” button in our webmail into the locked position. If you are not using our webmail, then we can set up a trigger word in the subject, where when the subject contains a specific word (for example “secure:”) then your outgoing email will be encrypted. You must contact us to have this trigger subject word setup for your domain. When this is setup, any email client can send encrypted outgoing email, including mobile devices by using this trigger word.

2)      PGP (Pretty Good Privacy) – If your 3rd party email program supports it, you can use PGP. PGP requires you to create a key which you install in your email client. When you send email using PGP, the email program encrypts your email before it leaves your computer. For the receiver to un-encrypt your email and read it, they must have your public key which must be installed on their PGP supported email program. Due to these additional requirements, we do not suggest PGP if you want an easy and universally supported method of sending encrypted emails. We suggest using the Imageway Mail Vault above if you want a easier to use solution that is universally supported.

To ensure incoming email was sent securely from another domain, you have two options:

1)      If you are using our webmail (not the Mobile Office) and you see a “pad lock” icon next to the email sender or subject, then the email system that sent the email supported the ability to talk to our system over a secure encrypted connection and your email was sent securely. You should notice emails coming from GMail will have a pad lock icon, this is due to the fact Google’s GMail supports the ability to talk to our email system using a secure encrypted connection.

2)      If you are not using our webmail, then you will need to look at the full email headers for the “X-Encryption: SSL encrypted” text. You can search online to find out how to view email headers for your specific email program.  If you are using Mac Mail, you can add any email header to be shown in your email view by going to the “Viewing section” of the Mail preferences, choose the “Custom setting”, and then add the “X-Encryption: SSL encrypted” text. This is a nice feature Mac Mail supports.

Using the methods above, you can have a secure end-to-end encrypted email connection which provides additional security to your business. These advanced features are included with all our email packages.

Rate This Entry:
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

How to password protect a webpage location

Mon 15 April 13 Comments are Closed

There are times for security reasons when you might want to limit access to a specific file or directory by using a login and password.  One reason to do this would be to protect your WordPress installation, by limiting access to the wp-login.php script.  Adding the following to your webpage root .htaccess file will require login access to the wp-login script:

<FilesMatch "wp-login.php">
 AuthType Basic
 AuthName "Secure Area"
 AuthUserFile "/home/example/.htpasswds/webpage/wp-admin/.htpasswd"
 require valid-user
 </FilesMatch>

Additionally you can protect all files within a specific directory by putting the .htaccess file in the directory (for example /wp-admin/ directory in the case of WordPress) you want to password protect with the following:

AuthType Basic
 AuthName "Secure Area"
 AuthUserFile "/home/example/.htpasswds/webpage/wp-admin/.htpasswd"
 require valid-user

You just put the above information into a “.htaccess” file and upload to your location of choice. To create the “.htpasswd” file with users and passwords, please use the following online utility: http://www.htaccesstools.com/htpasswd-generator/

 

Rate This Entry:
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

How to limit webpage access by a specific IP address

Mon 15 April 13 Comments are Closed

There are times for security reasons when you might want to limit access to a specific file or directory by IP address.  One reason to do this would be to protect your WordPress installation, by limiting access to the wp-login.php script.  Adding the following to your webpage root .htaccess file and it will limit access to the wp-login script to a single IP address:

(ensuring you replace 100.100.100.101 with your own IP address)

<FilesMatch "^wp-login.php$">
	Order Deny,Allow
	Allow from 100.100.100.101
	Deny from all
</FilesMatch>

Or to protect the administrator login page for Joomla instead of WordPress add:

<FilesMatch "^administrator/index.php$">
	Order Deny,Allow
	Allow from 100.100.100.101
	Deny from all
</FilesMatch>

Additionally you can protect all files within a specific directory by putting the .htaccess file in the directory (for example /wp-admin/ directory in the case of WordPress) you want to protect with the following:

Order Deny,Allow
Deny from all
Allow from 100.100.100.100
  • Optional: You can enter partial IP Addresses, such as, 100.100.100. This allows access to a range of addresses.
  • Optional: You can add multiple addresses by separating them with comma’s.
100.100.100.101, 100.100.100.102

You can also accomplish the above by using rewrite rules inside the .htaccess file, for example:

Single IP address access

To allow access from a single IP address, replace 123\.123\.123\.123 with your own IP address:

RewriteCond %{REQUEST_URI} ^(.*)?wp-login\.php(.*)$ [OR]
 RewriteCond %{REQUEST_URI} ^(.*)?wp-admin$
 RewriteCond %{REMOTE_ADDR} !^123\.123\.123\.123$
 RewriteRule ^(.*)$ - [R=403,L]

Multiple IP address access

To allow access from multiple IP addresses, replace 123\.123\.123\.xxx with your own IP addresses:

RewriteCond %{REQUEST_URI} ^(.*)?wp-login\.php(.*)$ [OR]
 RewriteCond %{REQUEST_URI} ^(.*)?wp-admin$
 RewriteCond %{REMOTE_ADDR} !^123\.123\.123\.121$
 RewriteCond %{REMOTE_ADDR} !^123\.123\.123\.122$
 RewriteCond %{REMOTE_ADDR} !^123\.123\.123\.123$
 RewriteRule ^(.*)$ - [R=403,L]

If your IP address changes, or you have a very large amount of possible IPs you’re connecting from, you can protect your WordPress site by only allowing login requests coming directly from your domain name. Simply replace example\.com with your own domain name

RewriteCond %{REQUEST_METHOD} POST
 RewriteCond %{HTTP_REFERER} !^http://(.*)?example\.com[NC]
 RewriteCond %{REQUEST_URI} ^(.*)?wp-login\.php(.*)$ [OR]
 RewriteCond %{REQUEST_URI} ^(.*)?wp-admin$
 RewriteRule ^(.*)$ - [F]

 

Rate This Entry:
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

PHP Web Development

Thu 20 December 12 Comments are Closed

What is PHP? PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML. If you are new to PHP and want to get some idea of how it works, try the introductory tutorial. After that, check out the online manual. Our servers at Imageway have been heavily optimized to run PHP as quickly as possible.

We suggest before publishing your PHP website to our servers you create a local test environment where you can test your PHP website first.  If you have a Windows desktop, then we suggest you use WampServer (http://www.wampserver.com/en/). This software is a Windows PHP web development environment. It allows you to create web applications with Apache2, PHP and a MySQL database. Alongside, PhpMyAdmin allows you to manage easily your databases.  WampServer allows you to test your PHP project against various versions of PHP and MySQL very easily. If you are using Linux, Unix, or MAC X then we suggest you use XAMPP (http://www.apachefriends.org/en/xampp.html) for your PHP test environment.

If you install “WampServer” or “XAMPP” on Windows or Mac OS X, be sure to edit the MySQL database “my.ini” configuration file, and add (or change) this line:

lower_case_table_names=2

Once you edit the “my.ini” be sure to restart WampServer or XAMPP.  This needs to be set before you create any databases for a project.  The reason you need this set on Windows or Mac OS X is because we run Linux/Unix servers which are case-sensitive. We have our servers set to “lower_case_table_names=0”, which means MySQL will operate and create things in a case-sensitive way.  Windows or Mac OS X (by default) is not case-sensitive, and you could run into issues when you convert projects created on Windows PHP/MySQL to PHP/Linux/Unix MySQL.  The way to avoid this is to set “lower_case_table_names=2” on your test server.  For more information please see: http://dev.mysql.com/doc/refman/5.5/en/identifier-case-sensitivity.html.

For writing your PHP code we suggest you use Netbeans (http://netbeans.org/), which is available for multiple operating systems. Netbeans is a complete IDE (integrated development environment) that allows you quickly and easily develop desktop, mobile, and web applications in various languages. For more information about NetBeans features for PHP check out: http://netbeans.org/features/php/index.html.

A software framework is a universal, reusable software platform to develop software applications, products and solutions. There are several PHP frameworks, but the one we suggest is CodeIgniter (https://ellislab.com/codeigniter). We suggest this framework because it is a simple framework to use, and has a small footprint (less overhead to slow down your program). The larger fuller frameworks can be slower because of the additional overhead (with the exception of the C based framework Phalcon).

If you want a software versioning  and revision control system, then we currently offer “Subversion”. Subversion can be setup on your existing Imageway hosting account by contacting us.  We will setup the server software for you, so you will have the ability to connect and access your own running Subversion server. If you have a Windows desktop, then we suggest using TortoiseSVN (http://tortoisesvn.tigris.org/) to interact with the subversion server. If you want a good paid solution that works with multiple operating systems, then we suggest looking at SmartSVN (http://www.smartsvn.com/).  In addition, Adobe Dreamweaver has built in Subversion support. For more information about using subversion with Dreamweaver, check out: http://helpx.adobe.com/dreamweaver/kb/subversion-resources-dreamweaver-cs4-cs5.html.

Lastly, do not forget to program using good PHP security practices. A good website to start with is: https://www.owasp.org/index.php/PHP_Security_Cheat_Sheet#DRAFT_CHEAT_SHEET_-_WORK_IN_PROGRESS

All of the above will help you get started with creating PHP applications. Our servers have been heavily optimized for PHP and MySQL through various methods. So once your application has been developed and tested locally, you can upload all the data to our servers so it will be available on the Internet for everyone to use.

Rate This Entry:
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

Optimizing Magento

Wed 03 October 12 Comments are Closed

Magento is a very popular eCommerce application. It offers a great deal of customization and abilities from initial install. Here are a few suggestions for optimizing a Magento installation.


Changes to .htaccess

Enable Output Compression

In your .htaccess file for Magento you will find a section of text starting with the line, <IfModule mod_deflate.c> and ending at </IfModule>

This section of code can be used to turn on Apache’s mod_deflate module, which provides compression for text, css, and javascript. You will want to uncomment (remove the # symbol) multiple lines so that it looks like this:

<IfModule mod_deflate.c>############################################
## enable apache served files compression
## http://developer.yahoo.com/performance/rules.html#gzip

# Insert filter on all content
SetOutputFilter DEFLATE
# Insert filter on selected content types only
AddOutputFilterByType DEFLATE text/html text/plain text/xml
text/css text/javascript

# Netscape 4.x has some problems…
BrowserMatch ^Mozilla/4 gzip-only-text/html

# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip

# MSIE masquerades as Netscape, but it is fine
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

# Don’t compress images
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary

# Make sure proxies don’t deliver the wrong content
Header append Vary User-Agent env=!dont-vary

</IfModule>

Note: Some of the lines were word-wrapped by the web browser. You may want to copy and paste to make sure everything is on the correct lines.

Enable Expires Headers

First-time visitors to your page have to make several HTTP requests. By using the “Expires” header you make the components  of the requests cacheable. This avoids unnecessary HTTP requests on subsequent page views.

You want to find the area of the .htaccess file that starts with <IfModule mod_expires.c> and ends with the first </IfModule> you see after it, and make it look like this:

<IfModule mod_expires.c>############################################
## Add default Expires header
##http://developer.yahoo.com/performance/rules.html#expires

ExpiresActive On
ExpiresDefault “access plus 1 year”

</IfModule>

Note: Some of the lines were word-wrapped by the web browser. You may want to copy and paste to make sure everything is on the correct lines.


Magento Administration Tweaks

Merge CSS and JS

This particular tweak will reduce the number of HTTP requests on your eCommerce site. If you are using a Magento version prior to 1.4.x, the free extension Fooman_Speedster can be used, if you are running a later version of Magento follow this:

  1. Login to your administration area and go to – System > Configuration > Developer
  2. Under “JavaScript Settings”, change “Merge JavaScript Files” to yes.
  3. Under “CSS Settings”, change “Merge CSS Files” to yes.
  4. Finally you will want to clear your Magento cache.

Enabling Flat Catalog

The model Magento uses to store customer and product data results in longer than average SQL queries and more reads. Enabling the Flat Catalog option for Categories and Products will merge product data into one table, therefore improving performance.

  1. Login to your administration area and go to – System > Configuration > Catalog
  2. Under “Frontend”, change “Use Flat Catalog Category” to yes.
  3. Under “Frontend”, change “Use Flat Catalog Product” to yes – this is optional.
  4. Finally you will want to clear your Magento cache.

Database Maintenance Tips

One of the main issues with Magento sites running slowly, is a database that has become large and difficult to use for sending/retrieving data from.

Here are a few tips for reducing the size of your Magento database.

NOTE: Please be sure to backup your database before performing any of the following changes.

Database Logs

There are several tables used by Magento for logging. While logging is very important regarding knowing what has and is going on with your store, the logs can become large very quickly, so regularly maintenance can be of great assistance.

Here are the tables for logging:

log_customer
log_visitor
log_visitor_info
log_url
log_url_info
log_quote
report_viewed_product_index
report_compared_product_index
report_event
catalog_compare_item

Database Log Cleaning using Magento Administration

  1. In Magento Administration go to System > Configuration
  2. In the left menu under Advanced click on System
  3. Under “Log Cleaning”, change “Enable Log Cleaning” to YES and configure the Save Log for 14 days.
  4. Click “Save Config”

log.php Utility

Magento provides a shell utility that can be configured using Cron or run manually to clean the database logs.

Manually

Log into your account via SSH and cd to the Magento root directory then type:

php -f shell/log.php clean

You can use the -days switch to specify how many days back to save

Cron

This is an example only:

php -f /home/yourcpanelusername/public_html/path/to/magento/shell/log.php

Note: The above line is on one line and may have been word-wrapped by the web browser. You may want to copy and paste to make sure everything is on one line.

Database Cleaning via phpMyAdmin

Using phpMyAdmin offers more flexibility and efficiency when working with databases.

  1. Login to the database admin
  2. Click on the database associated with your Magento installation
  3. Now select these tables:

log_customer
log_quote
log_summary
log_summary_type
log_url
log_url_info
log_visitor
log_visitor_info
log_visitor_online

  1. Below the tables listed, click on the drop-down box “With Selected:” and select Empty
  2. You will get a confirmation screen, click Yes.

You will want to perform this database log cleaning on a regular basis. Utilizing the cron job option will ensure it is done without the need to perform any manual tasks. You will want to be sure you have properly setup this cron.

Rate This Entry:
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

How do I optimize or repair a MySQL database

Wed 03 October 12 Comments are Closed

You can manage your databases by utilizing our web based online database tool at: https://database.imageway.com

Optimize Tables

  1. Select the database you want to optimize from the list in the left column, which should take you to the “structure” tab for the database.
  2. Select the tables you wish to optimize by checking the check box in front of each one, or clicking on Select All if you want to optimize all of them.
  3. On the drop down box that says “with selected…” select “Optimize Table.”  This will optimize the table and take you to a new screen.

Repair Tables

  1. Select the database you want to repair from the list in the left column, which should take you to the “structure” tab for the database.
  2. Select the tables you wish to repair by checking the check box in front of each one, or clicking on Select All if you want to repair all of them.
  3. On the drop down box that says “with selected…” select “Repair Table.”  This will repair the table and take you to a new screen.
Rate This Entry:
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

 

back to top