70-519 Passed!!!
7:00 | Author: Unknown

Después de esperar y esperar, los examenes beta de .Net 4 están pasando a producción. Por lo que me empiezan a llegar las noticias esperadas. Y la primera es 70-519 aprobado. Vamos por los otros! (esto me salió medio mundialista)

 

image


Sigo en el camino de la certificación.

Stress & load web tests
7:51 | Author: Unknown

Posteé un primer artículo en el el blog de Southworks. Siguiendo la costumbre de este blog, la idea es postear aquí en castellano por lo que voy a intentar traducirme. Puede considerarse cross-posting.

Primeras semanas

Van pasando mis primeras semanas en Southworks, tuve diferentes desafios. Uno de ellos fue estresar un WorkerRole service localmente y en WindowsAzure.
Un WorkerRole es un rol para desarrollos generales y puede realizar procesamiento background para un web role. Una vez deployado localmente obtenemos una URL a nuestro servicio WCF.
Trabajando con esta arquitectura necesitamos estresar los request a este servicio para verificar distintos comportamientos de Windows Azure. El principal objetivo de el stress test es descubrir la recuperabilidad de el servicio o el server testeado.

Stress test usando Pylot

Existe una multiplicidad de herramientas caras para estresar web services. Decidimos utilizar una muy buena solución open source realizada en Python llamada Pylot.

 

Instalando Pylot

Pylot es un script Pyhton y utiliza librerias wxPython para la interfaz gráfica, NumPy and MatPlotLib para reportes y gráficos.

 

Usando Pylot

Usar la GUI de Pylot es elemental. Debemos crear un xml con los casos de prueba.

 

   1: <case>    




   2:      <url>http://www.goldb.org/foo</url>




   3:     <verify>Copyright.*Corey Goldberg</verify>




   4:     <verify_negative>Error</verify_negative>




   5: <case>






Visual Studio 2010 Stress tests



Más allá de la solución de Pylot, en algunos casos necesitamos una pequeña aplicación para solucionar temas particulares. StressService es un servicio realizado en c#. Podemos estresar nuestro server con este simple contrato.



Utilizaremos el Load Test de Visual Studio 2010 para crear el stress test. Para hacer esto crearemos un unit test que realice la acción que queremos estresar.





   1: [ServiceContract]




   2: public interface IStresserService




   3: {




   4:         [OperationContract]




   5:         int SimpleRequest(string url);




   6:  




   7:         [OperationContract]




   8:         List<int> Stress(int workers, string url);




   9: }






Implementación del contrato.





   1: public class StresserService : IStresserService




   2: {




   3:     public int SimpleRequest(string url)




   4:     {




   5:         if (string.IsNullOrEmpty(url))




   6:             throw new ArgumentOutOfRangeException("url");




   7:         HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);




   8:         HttpWebResponse response;




   9:         try




  10:         {




  11:             response = (HttpWebResponse)request.GetResponse();




  12:         }




  13:         catch (WebException e)




  14:         {




  15:             return (int)((HttpWebResponse)e.Response).StatusCode;




  16:         }




  17:         return (int)response.StatusCode;




  18:     }




  19:  




  20:     public List<int> Stress(int workers, string url)




  21:     {




  22:         var results = new List<int>();




  23:         Parallel.For(0, workers, t =>




  24:         {




  25:             results.Add(SimpleRequest(url));




  26:  




  27:         });




  28:         Thread.Sleep(10000);




  29:         return results;




  30:     }




  31: }






 





   1: [TestMethod]




   2: public void ItShouldCreateNStressers()




   3: {




   4:     IStresserService service = new StresserService();




   5:     var results = service.Stress(100, @"http://localhost/");




   6:  




   7:     Assert.AreEqual(100, results.Count());




   8: }






Creamos el Load Test para estresar utilizando muchos usuarios durante un tiempo T.



 



imageimage



Próximos pasos: escalar la solución.



Podemos escalar la solución comenzando nuevos servicios en otras máquinas y sincronizando los diferentes workers creando un manager.



 



image



Requerimientos desde diferentes dominios



La solución está estresando desde el mismo dominio. Podemos tener diferentes problemas (por ej. D.O.S.) que se pueden sobrellevar utilizando otros servicios como  Gomez

Empiezo esta semana a blogear (valga el anglicismo) no sólo aquí, sino que también en el blog que me brinda Southworks, mi nuevo empleador. Se pueden dar una vuelta (por ahora está vacío) y también conocer todas los otros muy interesantes posts de los distintos compañeros.

Mariano Koldobsky en Southworks

Blogs de Southworks

getJson desde Asp.Net MVC
11:07 | Author: Unknown

Muchas veces utlizando Asp.Net MVC nos encontramos con la necesidad de acceder a resultados de nuestros metodos del controller, pero no queremos realizar un POST al server. Una buena opción es el llamado de JQuery utilizando la función getJson.

Vamos a llamar a un servicio que nos devuelve una definición de diccionario de una palabra en inglés.
La vista es super elemental tiene un ingreso de palabra (no estamos validando nada en este ejemplo, tampoco estamos testeando, lo cual seria un interesante posteo. Cómo testeo una llamada de AJAX?) y un botón para buscar la definición.

View
    <button id="btnDefine" name="btnDefine">
Define</button>
<br />
<%= Html.TextBox("tbxWord") %>
<%= Html.TextArea("txtDefinition") %>
<div id="loading">
Loading</div>

<script type="text/javascript">

$(document).ready(function() {
$(function() {
$("#loading").hide();
$('#btnDefine').click(function() {
$("#loading").ajaxStart(function() {
$("#loading").show();
});
wordIn = $("#tbxWord").val();
$.getJSON("/Home/GetDefinition", { word: wordIn }, function(data) {
$("#txtDefinition").text(data);
});
});
$("#loading").hide();
});
});


</script>




La línea getJson tiene como parametros el ruteo del método del controller, el parámetro del método (en este caso la palabra a buscar) y una función de callback que se llamará cuando vuelve del llamado AJAX, en este caso sólo setea el testo de la definición.


 


 


Controller
        public JsonResult GetDefinition(string word)
{
DictService dictionary = new DictService();
if (word == null) return null;
var result = dictionary.Define(word);
return Json(result.Definitions[0].WordDefinition, JsonRequestBehavior.AllowGet);
}
En el caso del método del controller llamado, sólo tenemos que tener en cuenta devolver un JsonReesul 
y utilizar la clase Json para serializar lo que devolvemos.
Es un buen comienzo.
 
 
 

70-516 Exam – parte única
8:14 | Author: Unknown

Sólo posteo la guía no voy a llegar a poner links. Pero bueno la red proveera.

 

Modeling Data (20%)

  • Map entities and relationships by using the Entity Data Model.

    This objective may include but is not limited to: using the Visual Designer, building an entity data model from an existing database, managing complex entity mappings in EDMX, editing EDM XML, mapping to stored procedures, creating user-defined associations between entities, generating classes with inheritance and mapping them to tables

    This objective does not include: using MetadataWorkspace
  • Map entities and relationships by using LINQ to SQL.

    This objective may include but is not limited to: using the Visual Designer, building a LINQ to SQL model from an existing database, mapping to stored procedures
  • Create and customize entity objects.

    This objective may include but is not limited to: configuring changes to an Entity Framework entity, using the ADO.NET EntityObject Generator (T4), extending, self-tracking entities, snapshot change tracking, ObjectStateManager, partial classes, partial methods in the Entity Framework
  • Connect a POCO model to the Entity Framework.

    This objective may include but is not limited to: implementing the Entity Framework with persistence ignorance, user-created POCO entities

    This objective does not include: using the POCO templates
  • Create the database from the Entity Framework model.

    This objective may include but is not limited to: customizing the Data Definition Language (DDL) (templates) generation process, generating scripts for a database, Entity Data Model tools
  • Create model-defined functions.

    This objective may include but is not limited to: editing the Conceptual Schema Definition Language CSDL, enabling model-defined functions by using the EdmFunction attribute, complex types

Managing Connections and Context (18%)

  • Configure connection strings and providers.

    This objective may include but is not limited to: managing connection strings including Entity Framework connection strings, using the ConfigurationManager, correctly addressing the Microsoft SQL Server instance, implementing connection pooling, managing User Instanceand AttachDBfilename, switching providers, implementing multiple active result sets (MARS)

    This objective does not include: using the ConnectionStringBuilder; Oracle data provider; creating and using a custom provider; using third-party providers
  • Create and manage a data connection.

    This objective may include but is not limited to: connecting to a data source, closing connections, maintaining the life cycle of a connection
  • Secure a connection.

    This objective may include but is not limited to: encrypting and decrypting connection strings, using Security Support Provider Interface (SSPI) or SQL Server authentication, read only vs. read/write connections

    This objective does not include:  Secure Sockets Layer (SSL)
  • Manage the DataContext and ObjectContext.

    This objective may include but is not limited to: managing the life cycle of DataContext and ObjectContext, extending the DataContext and ObjectContext, supporting POCO
  • Implement eager loading.

    This objective may include but is not limited to: configuring loading strategy by using LazyLoadingEnabled, supporting lazy loading with POCO, explicitly loading entities
  • Cache data.

    This objective may include but is not limited to: DataContext and ObjectContext cache including identity map, local data cache

    This objective does not include: Velocity, SqlCacheDependency
  • Configure ADO.NET Data Services.

    This objective may include but is not limited to: creating access rules for entities, configuring authorization and authentication, configuring HTTP verbs

Querying Data (22%)

  • Execute a SQL query.

    This objective may include but is not limited to: DBCommand, DataReader, DataAdapters, DataSets, managing data retrieval by using stored procedures, using parameters, System.Data.Common namespace classes
  • Create a LINQ query.

    This objective may include but is not limited to: syntax-based and method-based queries, joining, filtering, sorting, grouping, aggregation, lambda expressions, paging, projection

    This objective does not include: compiling queries
  • Create an Entity SQL (ESQL) query.

    This objective may include but is not limited to: joining, filtering, sorting, grouping, aggregation, paging, using functions, query plan caching, returning a reference to an entity instance, using parameters with ESQL, functionality related to EntityClient classes
  • Handle special data types.

    This objective may include but is not limited to: querying BLOBs, filestream, spatial and table-valued parameters

    This objective does not include: implementing data types for unstructured data, user-defined types, Common Language Runtime (CLR) types
  • Query XML.

    This objective may include but is not limited to: LINQ to XML, XmlReader, XmlDocuments, XPath

    This objective does not include: XSLT, XmlWriter
  • Query data by using ADO.NET Data Services.

    This objective may include but is not limited to: implementing filtering and entitlement in ADO.NET Data Services, addressing resources, creating a query expression, accessing payload formats, Data Services interceptors

Manipulating Data (22%)

  • Create, update, or delete data by using SQL statements.

    This objective may include but is not limited to: Create/Update/Delete (CUD), using DataSets, calling stored procedures, using parameters
  • Create, update, or delete data by using DataContext.

    This objective may include but is not limited to: CUD, calling stored procedures, using parameters

    This objective does not include: ObjectTrackingEnabled
  • Create, update, or delete data by using ObjectContext.

    This objective may include but is not limited to: CUD, calling stored procedures, using parameters, setting SaveOptions
  • Manage transactions.

    This objective may include
    but is not limited to: System.Transactions, DBTransaction, rolling back a transaction, Lightweight Transaction Manager (LTM)

    This objective does not include: distributed transactions, multiple updates within a transaction, multiple synchronization of data within an acidic transaction
  • Create disconnected objects.

    This objective may include but is not limited to: creating self-tracking entities in the Entity Framework, attaching objects, DataSets, table adapters

Developing and Deploying Reliable Applications (18%)

  • Monitor and collect performance data.

    This objective may include but is not limited to: logging generated SQL (ToTraceString), collecting response times, implementing performance counters, implementing logging, implementing instrumentation
  • Handle exceptions.

    This objective may include but is not limited to: resolving data concurrency issues (handling OptimisticConcurrency exception, Refresh method), handling errors, transaction exceptions, connection exceptions, timeout exceptions, handling an exception from the Entity Framework disconnected object, security exceptions
  • Protect data.

    This objective may include but is not limited to: encryption, digital signature, hashing, salting, least privilege
  • Synchronize data.

    This objective may include but is not limited to: online/offline Entity Framework, synchronization services, saving locally
  • Deploy ADO.NET components.

    This objective may include but is not limited to: packaging and publishing from Visual Studio, deploying an ADO.NET Services application; packaging and deploying Entity Framework metadata

    This objective does not include: configuring IIS, MSDeploy, MSBuild

      70-519 Exam – parte 5
      18:12 | Author: Unknown

      Managing the Service Instance Life Cycle (13%)

      Manage service instances.

      This objective may include but is not limited to: per call: per session; single; code and configuration; activation and deactivation; durable services; throttling

      http://msdn.microsoft.com/en-us/magazine/cc163590.aspx

       

      Manage sessions.
      This objective may include but is not limited to: code and configuration; session management attributes; throttling; reliable sessions; transport-level and application-level sessions; invoking a callback contract.
      Implement transactions.
      This objective may include but is not limited to: distributed transactions; transactional queues; transaction flow; configuring transaction binding attributes; WS-AtomicTransaction (WS-AT); transactional behavior attributes at the service and operation level; using transactions in code.
      Manage concurrency.
      This objective may include but is not limited to: single, multiple, and reentrant concurrency modes; SynchronizationContext and CallbackBehavior
      This objective does not include: deadlocks and other mutithreading issues
      Reentrant
      Manage consistency between instances, sessions, transactions, and concurrency
      This objective may include but is not limited to: possible combinations between instances, sessions, transactions, and concurrency (for example, instance mode single with concurrency mode multiple)
      70-513 exam – parte 4
      9:22 | Author: Unknown

       

      Securing Services (17%)

       

      Configure secure Bindings

      This objective may include but is not limited to: transport, message, mixed mode

       

      http://msdn.microsoft.com/en-us/library/ms731172(v=VS.100).aspx

       

      Configure message security

      This objective may include but is not limited to: specifying protection levels on different message parts

      http://msdn.microsoft.com/en-us/library/ms789036.aspx

      Implement Authentication

      • Implement Authentication.
        This objective may include but is not limited to: Microsoft ASP.NET Membership Provider, Custom Provider, Windows Integrated Security, certificates (X.509), Federated Authentication endpoint identity; configuring client credentials; Custom Validator
        This objective does not include: Geneva Framework
      • Implement Authorization.
        This objective may include but is not limited to: role based, claim based; configuring role providers for endpoints; principal permission attribute
        This objective does not include: rights-management authorization such as Active Directory Rights Management Services (AD RMS)
      • Implement Impersonation.
        This objective may include but is not limited to: configuration and code; configuring WCF-specific Internet Information Services (IIS) impersonation properties; configuring impersonation options; operation-based and service-based
      • Implement security auditing.
        This objective may include but is not limited to: using serviceSecurityAudit behavior, service auditing, audit log