1. Recently, when talking to a company that creates consumer electronics, an interesting idea popped up. This company is really struggling in minimizing their electricity bill and I was asked if GridGain could help. Interestingly enough, GridGain can help. Let's suppose you have two data centers, A and B, and data center A has low electricity costs between 12am and 12pm and data center B has low costs between 12pm and 12am. All you need to do to make sure that either data center is used during low cost time window is create GridLowElectricityTopologySpi as follows:

    @GridSpiInfo(author = "Your Name", version = "1.0")
    @GridSpiMultipleInstancesSupport(true)
    public class GridLowElectricityTopologySpi
    extends GridSpiAdapter
    implements GridTopologySpi {
    /** Auto-inject logger. */
    @GridLoggerResource
    private GridLogger log = null;

    /**
    * Start SPI.
    */
    public void spiStart(String gridName) {
    if (log.isInfoEnabled() == true) {
    log.info(startInfo());
    }
    }

    /**
    * Stop SPI.
    */
    public void spiStop() {
    if (log.isInfoEnabled() == true) {
    log.info(stopInfo());
    }
    }

    /**
    * Given whole grid topology return only nodes
    * selected for execution of this task.
    */
    public Collection<GridNode> getTopology(
    GridTaskSession ses,
    Collection<GridNode> grid) {
    int hour = Calendar.getInstance(Calendar.HOUR_OF_DAY);

    List<GridNode> top = new ArrayList<GridNode>(grid.size());

    for (GridNode node : grid) {
    String segment = node.getAttribute("segment");

    if (hour <= 12) {
    if (segment.equals("A")) {
    top.add(node);
    }
    }
    else if (segment.equals("B")) {
    top.add(node);
    }
    }

    return top;
    }
    }

    Now, the nodes from data center A need to have the following in their configuration (the configuration for data center B is analogous).

    <bean
    id="grid.cfg"
    class="org.gridgain.grid.GridConfigurationAdapter"
    scope="singleton">
    ...
    <property name="userAttributes">
    <map>
    <entry key="segment" value="A"/>
    </map>
    </property>
    ...
    </bean>

    This is all that needs to be done to lower your electric bill. Now all tasks will be routed to the data center with lowest electricity cost.

    Enjoy!

     

    1

    View comments

  2. GridGain will be presenting at Dallas Java User Group at Dallas, TX, on Wednesday, November 11th. If you are around the Dallas area and interested in Cloud Computing - come see the presentation. As usual we'll have lively discussion on clouds and grids and as always plenty of live coding that you won't see anywhere else - live cloud application in 10 minutes from scratch!. We also going to show some sneak peek preview of GridGain 3.0, including live Cloud Demos.
    1

    View comments

About me
About me
- Antoine de Saint-Exupery -
- Antoine de Saint-Exupery -
"A designer knows he has achieved perfection not when there is nothing left to add, but when there is nothing left to take away."
Blog Archive
Blogs I frequent
Loading
Dynamic Views theme. Powered by Blogger.