Saltar al contenido

Tecnología

Tecnología en General

Apache – prefork vs. worker mode, how to check mode and more

  • admin 

Referencia:

https://communities.ca.com/web/ca-identity-and-access-mgmt-distributed-global-user-community/message-board/-/message_boards/view_message/98290538

 

This Tuesday Tip will cover some common questions regarding Apache, specifically prefork vs. worker mode, how to change the default value on RedHat, Solaris and other operating systems as well as verifying what mode apache is currently running in.

A. The default MPM for Unix is the Prefork module.
B. The Worker MPM was introduced in Apache2.

Now Comparing between Worker MPM and Prefork MPM.

Prefork MPM
– prefork MPM uses multiple child processes with one thread each.
– Each process handles one connection at a time and uses more memory.
– Good for non-thread-safe third party modules.

Worker MPM
– worker MPM uses multiple child processes with many threads each.
– Each thread handles one connection at a time.
– Good for high-traffic, smaller memory footprint.

MPM uses a multi-process and multi-threaded structure.
Multi-process –> multi PIDs (use ‘ps -aef’ to find out)
Multi-thread –> more connections per PID. (use ‘lsof’ (on Solaris) to find out. ‘netstat -an’ (You really won’t see everything.)

The worker MPM uses multiple child processes. It’s multi-threaded within each child, and each thread handles a single connection. Worker is fast and highly scalable and the memory footprint is comparatively low. It’s well suited for multiple processors.

Prefork MPM is preferred for better compatibility with older software or for better stability although it uses more memory. It handles requests in a manner similar to Apache 1.3. It is appropriate for sites that need to avoid threading for compatibility with non-thread-safe libraries. It is also the best MPM for isolating each request, so that a problem with a single request will not affect any other. Prefork is well suited for single or double CPU systems, speed is comparable to that of worker, and it’s highly tolerant of faulty modules and crashing children – but the memory usage is high, and more traffic leads to greater memory usage.

Conclusion: For most new websites that are that use thread safe libraries, use multiple processes and high traffic sites, CA SiteMinder recommends MPM worker mode for Apache.

>>>>>>>>>>>

How to tell if I’m running Apache in prefork or worker MPM? (Multi-Processing Module)

Note : You can have one and only one MPM module loaded in apache at any one time.

From the bin directory, you can run ./apachectl -V (Capital V)

./apache2/bin/apachectl -V
Server version: Apache/2.0.50
Server built: Aug 3 2004 16:52:20
Server’s Module Magic Number: 20020903:8
Architecture: 32-bit
Server compiled with….
-D APACHE_MPM_DIR=»server/mpm/prefork» (This is running in prefork mode)

Newer version running in worker mode:

./apachectl -V
Server version: Apache/2.2.21 (Unix)
Server built: Oct 23 2011 17:42:11
Server’s Module Magic Number: 20051115:30
Server loaded: APR 1.4.5, APR-Util 1.3.12
Compiled using: APR 1.4.5, APR-Util 1.3.12
Architecture: 32-bit
Server MPM: Worker <——Worker
threaded: yes (fixed thread count)
forked: yes (variable process count)
Server compiled with….
-D APACHE_MPM_DIR=»server/mpm/worker» <- This same line will still exist.

A second way to check, again from the bin directory:

#./ httpd -l
Compiled in modules:
core.c
prefork.c <—- Prefork
http_core.c
mod_so.c

./httpd -l
Compiled in modules:
core.c
mod_access.c
mod_auth.c
mod_include.c
mod_log_config.c
mod_logio.c
mod_env.c
mod_setenvif.c
worker.c <—–Worker

>>>>>>>>>>>

How do I change the default value on RHEL (Red Hat Enterprise Release)?

Edit the /etc/sysconfig/httpd file.

Change #HTTPD=/usr/sbin/httpd.worker

to

HTTPD=/usr/sbin/httpd.worker

and stop/start the apache service.

>>>>>>>>>>>

Solaris or most unix like operating systems.

When I download the code from apache.org and use certain flags to compile apache, what flag do I use for worker mode?

./configure –with-mpm=worker

For all compile options, please reference www.apache.org

 

Comprobación de Páginas Web

  • admin 

 

Cuando creamos una página web se debe realizar la oportuna comprobación de Páginas Web.

¿Es la página web lo suficientemente rápida? Si no es, ¿que acciones pueden acelerar su rapidez y operación? Por no hablar de la importancia de las keywords y el posicionamiento SEO.

Con unos pocos de conocimientos y haciendo un seguimiento de lo que indican los informes sucesivamente se pueden hacer cambios que permitan incrementar y mejorar la calidad y el posicionamiento de la Web.

 

Herramientas de Comprobación de Páginas Web:

a) Rapidez de la web

 https://my.pingdom.com/

 

b) Validador del sitemap.xml

 

c) Comprobación de SEO

 

d) Check de la web en general

 

Además hay una serie de extensiones para chrome muy útiles. Particularmente me gusta SeoQuake.

 

Apple Touch Icon

Similar to the Favicon, the apple-touch-icon.png is a file used for a web page icon on the Apple iPhone, iPod Touch, and iPad. When someone bookmarks your web page or adds your web page to their home screen this icon is used. If this file is not found these Apple products will use the screen shot of the web page, which often looks like no more than a white square.

This file should be saved as a .png, have dimensions of 57 x 57, and be stored in your home directory, unless the path is specified in the HTML using the below code.

<link rel=»apple-touch-icon» href=»/custom_icon.png»/>

When this file is used, by default, the Apple product will automatically give the icon rounded edges and a button-like appearance.

 

Referencia:  http://www.computerhope.com/jargon/a/appletou.htm

How To Create And Install A favicon.ico

  • admin 

What is a Favicon

Favicon is short for «Favourites Icon» («Favorites Icon» for you Americans ;). The name is derived from the bookmark list for Microsoft Internet Explorer which is called Favorites/Favourites list. When you add a site to your Favourites/Favorites list, Internet Explorer (version 5 and above) asks the server if it has a file called favicon.ico. If present, this file will be used to provide an icon that is displayed next to the bookmark text.

Other browsers such as Mozilla have also added support for favicons. Depending on the browser, the favicon can appear in a variety of places, not just in the bookmarks list (in fact, it may not even appear in the bookmark list at all). It may be shown in the address bar or the title of a browser tab, for instance.

How to create a Favicon

To create a favicon.ico simply create a 16×16 .PNG file and convert it to an icon resource with png2ico. If you want, you can add more images to the same icon resource to provide alternative resolutions. Most browsers only use a 16×16 image but in a different context (e.g. when you drag a URL from the address bar onto your desktop) a larger icon may be shown. If the icon resource only contains a 16×16 image, this will be scaled to the appropriate size, so technically there is never a need to add alternative resolutions. However, doing so can increase the quality of the displayed icon.

Keep in mind that for a user with a slow modem a favicon.ico may increase the page loading time by a few seconds if it is too large, so don’t overdo it. Adding a 32×32 alternative should be enough to make sure the image will look good even in contexts with larger icons. Adding even more and larger alternatives is unnecessary bloat. Try to keep the number of colors below 16 and create a 16-color icon using the --colors 16 switch of png2ico (or even create a b/w icon with the --colors 2 switch). This will result in a smaller file that loads faster.

When you create the images to include in your favicon.ico, don’t forget that the icon may be composed against various background colors so you should use transparency rather than a solid background if you want to avoid that your icon appears inside a box. Note, that icon resources only support binary transparency, i.e. a pixel may be visible or invisible but not something like 30% translucent.

Installing your Favicon

To add your new favicon.ico to a web page put it on the server into the same directory as the web page it is for (e.g. www.example.com/foo/favicon.ico for www.example.com/foo/index.html). That is the first place a browser will search. If it doesn’t find an icon there, it checks the top-level directory of the server (www.example.com/favicon.ico for the www.example.com server), so by putting it there you can have a default favicon for all the pages in your domain. Depending on browser and configuration, the favicon.ico is not always rendered, even if it is in one of the above locations, unless the web page explicitly declares its presence. To declare that your web page has an icon, you add the following 2 lines into the <head> section of your page:

<link rel="icon" href="favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">

 

Referencia: http://www.winterdrache.de/freeware/png2ico/favicon.html

UML Casos de Uso (Use Case)

Fuente: http://users.dcc.uchile.cl/~psalinas/uml/casosuso.html#actor
Introducción

El diagrama de casos de uso representa la forma en como un Cliente (Actor) opera con el sistema en desarrollo, además de la forma, tipo y orden en como los elementos interactuan (operaciones o casos de uso).

Un diagrama de casos de uso consta de los siguientes elementos:

Elementos

  • Actor

     

    Una definición previa, es que un Actor es un rol que un usuario juega con respecto al sistema. Es importante destacar el uso de la palabra rol, pues con esto se especifica que un Actor no necesariamente representa a una persona en particular, sino más bien la labor que realiza frente al sistema.

    Como ejemplo a la definición anterior, tenemos el caso de un sistema de ventas en que el rol de Vendedor con respecto al sistema puede ser realizado por un Vendedor o bien por el Jefe de Local.

  • Caso de Uso

     

    Es una operación/tarea específica que se realiza tras una orden de algún agente externo, sea desde una petición de un actor o bien desde la invocación desde otro caso de uso.

  • Relaciones

    • Asociación 

      Es el tipo de relación más básica que indica la invocación desde un actor o caso de uso a otra operación (caso de uso). Dicha relación se denota con una flecha simple.

    • Dependencia o Instanciación 

      Es una forma muy particular de relación entre clases, en la cual una clase depende de otra, es decir, se instancia (se crea). Dicha relación se denota con una flecha punteada.

    • Generalización 

      Este tipo de relación es uno de los más utilizados, cumple una doble función dependiendo de su estereotipo, que puede ser de Uso (<<uses>>) o de Herencia (<<extends>>).

      Este tipo de relación esta orientado exclusivamente para casos de uso (y no para actores).

      extends: Se recomienda utilizar cuando un caso de uso es similar a otro (características).

      uses: Se recomienda utilizar cuando se tiene un conjunto de características que son similares en más de un caso de uso y no se desea mantener copiada la descripción de la característica.

      De lo anterior cabe mencionar que tiene el mismo paradigma en diseño y modelamiento de clases, en donde esta la duda clásica de usar o heredar.

Ejemplo:

Como ejemplo esta el caso de una Máquina Recicladora:

Sistema que controla una máquina de reciclamiento de botellas, tarros y jabas. El sistema debe controlar y/o aceptar:

  • Registrar el número de ítemes ingresados.
  • Imprimir un recibo cuando el usuario lo solicita:
    1. Describe lo depositado
    2. El valor de cada item
    3. Total
  • El usuario/cliente presiona el botón de comienzo
  • Existe un operador que desea saber lo siguiente:
    1. Cuantos ítemes han sido retornados en el día.
    2. Al final de cada día el operador solicita un resumen de todo lo depositado en el día.
  • El operador debe además poder cambiar:
    1. Información asociada a ítemes.
    2. Dar una alarma en el caso de que:
      1. Item se atora.
      2. No hay más papel.

Como una primera aproximación identificamos a los actores que interactuan con el sistema:

Luego, tenemos que un Cliente puede Depositar Itemes y un Operador puede cambiar la información de un Item o bien puede Imprimir un informe:

Además podemos notar que un item puede ser una Botella, un Tarro o una Jaba.

Otro aspecto es la impresión de comprobantes, que puede ser realizada después de depositar algún item por un cliente o bien puede ser realizada a petición de un operador.

Entonces, el diseño completo del diagrama Use Case es: