Octubre 2014
Shoe Lovers @ dev.f
Retos
• Hacer lo que te apasiona.
• Las recompensas vienen solas.
• Utilizar todas las herramientas a tu alcance.
Shoe Lovers• Comunidad con 25,000,000 de seguidores en
Facebook.
• Más de 8,000,000 de interacciones al día.
• Social Commerce (uso de interacciones sociales para facilitar y promovers transacciones electrónicas de compra/venta).
• Un reto técnico pero al final un negocio rentable.
Primeros Hacks
¿Comprar o construir?
Escalando
• Infraestructura
• Equipos
Nuestro Stack
• LAMP (SoftLayer, AWS)
• Google Cloud
LAMP AWS• EC2 (Elastic Compute Cloud, instance types, zones)
• S3 (Simple Storage Service)
• Load Balancer (Sessions)
• RDS (Relational Database Server)
• Managed vs. Self Managed
• Master & Read Replica(s) -> delay
• Redshift, DynamoDB, ElastiCache, SES, SQS
• Autoscaling (cloudwatch)
• Caching (redis, memcache)
• Optimizar para costos de operación
http://techblog.netflix.com/2012/06/asgard-web-based-cloud-management-and.html
LAMP AWS
Google Cloud• App engine
• Datastore (BigTable) (stats)
• Blobstore (image service) (demo)
• Memcache (ndb datastore api)
• CloudSQL
• Map-Reduce
• Compute Engine
Requests, Latency, Instances
class PostLike(ndb.Model): parent_id=ndb.StringProperty() sender_id=ndb.StringProperty() verb=ndb.StringProperty() created_time=ndb.IntegerProperty() source= ndb.StringProperty() #the source can be facebook or the website deleted = ndb.BooleanProperty(default=False) created = ndb.DateTimeProperty(auto_now_add=True) modify = ndb.DateTimeProperty(auto_now=True) post_picture=ndb.StringProperty() user_picture=ndb.StringProperty() !newLike= localmodels.PostLike(parent_id =parent_id, sender_id = sender_id, verb=verb, created_time=created_time , source=‘FBRT') !newLike.put() !newLike.key.delete() !likesPost= localmodels.PostLike.query(localmodels.PostLike.parent_id==post_id).fetch(10)
Datastore
Datastore
6 días de ‘Likes’
Datastore
6 días de ‘Comments’
Datastore
Blobstore & Image Serviceclass BlobstoreUploadHandler(blobstore_handlers.BlobstoreUploadHandler): def post(self): upload_files = self.get_uploads('file') blob_info = upload_files[0] blob_key=blob_info.key() serving_url= images.get_serving_url(blob_key) return serving_url !!!POST multipart/form-data !!
Blob key: AMIfv96pxt34ek2mz_aS8i24hTJW7ZAnELPf15B8rp2XYzCg8yz6JklfBejG1izZrnxeReSdvhlX6cXIkGABNu2esQQB5ocPxAumYCKdLqgGx8RRFTTTg7HvNiemHoEXi7u82uczHRolloLenagWJ9ASl-QHng2SRXvFZP_0045-Y8QjOGvRMkI !Serving URL (crop, resize):!http://lh3.ggpht.com/IhESBu6X7DGzTRc5F6LhfMEKN-3UhPXjv9_7d0nkg_2EOuQFhzu_TdBSnSi08mHVClWZ_po-j3lsFTISJPFJffP1e3o_xg=s0 !http://lh3.ggpht.com/IhESBu6X7DGzTRc5F6LhfMEKN-3UhPXjv9_7d0nkg_2EOuQFhzu_TdBSnSi08mHVClWZ_po-j3lsFTISJPFJffP1e3o_xg=s200 !http://lh3.ggpht.com/IhESBu6X7DGzTRc5F6LhfMEKN-3UhPXjv9_7d0nkg_2EOuQFhzu_TdBSnSi08mHVClWZ_po-j3lsFTISJPFJffP1e3o_xg=s200-c
Blobstore & Image Service
Memcache data = memcache.get(key) ! if data is None: data=getDataFromDB(key) memcache.add(key, data) return data
Memcache
Challenge
• Extract value from all that info:
• Patterns
• Trends
• Recommendations
Future• Big Query
• Backends
• Prediction.io
• Apache Spark (ML)
• Cassandra (Datastax)
References• https://github.com/coto/gae-boilerplate
• https://www.udacity.com/course/cs253
• http://es.slideshare.net/kigster/scaling-wanelocom-100x-in-six-months
• https://spark.apache.org/
• https://github.com/Netflix/asgard
• http://techblog.netflix.com/
–Anthony Robbins
“Focus on where you want to go, not on what you fear.”
Top Related